[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-26 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu updated 
https://github.com/llvm/llvm-project/pull/86568

>From 19dd9a13c21d70b42b9d68aed6fb0b5a5e494685 Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Mon, 25 Mar 2024 15:49:42 -0400
Subject: [PATCH 1/2] [lldb][Dwarf] Fix dwarf parse time for line table and
 .debug_abbrev.

---
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 08ce7b82b0c16a..8039a35ed8941c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -145,8 +145,10 @@ static PluginProperties () {
 
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(DWARFContext , llvm::DWARFDebugLine ,
-   dw_offset_t line_offset, dw_offset_t unit_offset) {
+   dw_offset_t line_offset, dw_offset_t unit_offset,
+   StatsDuration _time) {
   Log *log = GetLog(DWARFLog::DebugInfo);
+  ElapsedTime elapsed(parse_time);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF();
   llvm::DWARFContext  = context.GetAsLLVM();
@@ -693,6 +695,7 @@ llvm::DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
   if (debug_abbrev_data.GetByteSize() == 0)
 return nullptr;
 
+  ElapsedTime elapsed(m_parse_time);
   auto abbr =
   std::make_unique(debug_abbrev_data.GetAsLLVM());
   llvm::Error error = abbr->parse();
@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);
   llvm::DWARFDebugLine line;
-  const llvm::DWARFDebugLine::LineTable *line_table =
-  ParseLLVMLineTable(m_context, line, offset, dwarf_cu->GetOffset());
+  const llvm::DWARFDebugLine::LineTable *line_table = ParseLLVMLineTable(
+  m_context, line, offset, dwarf_cu->GetOffset(), m_parse_time);
 
   if (!line_table)
 return false;

>From ef97e93b9b26c6a1923ff3b6c3dad76a67f2b64d Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Tue, 26 Mar 2024 10:46:18 -0400
Subject: [PATCH 2/2] revert change in ParseLineTable

---
 lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 8039a35ed8941c..0f459706c05643 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -145,10 +145,8 @@ static PluginProperties () {
 
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(DWARFContext , llvm::DWARFDebugLine ,
-   dw_offset_t line_offset, dw_offset_t unit_offset,
-   StatsDuration _time) {
+   dw_offset_t line_offset, dw_offset_t unit_offset) {
   Log *log = GetLog(DWARFLog::DebugInfo);
-  ElapsedTime elapsed(parse_time);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF();
   llvm::DWARFContext  = context.GetAsLLVM();
@@ -1231,9 +1229,10 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
+  ElapsedTime elapsed(m_parse_time);
   llvm::DWARFDebugLine line;
-  const llvm::DWARFDebugLine::LineTable *line_table = ParseLLVMLineTable(
-  m_context, line, offset, dwarf_cu->GetOffset(), m_parse_time);
+  const llvm::DWARFDebugLine::LineTable *line_table =
+  ParseLLVMLineTable(m_context, line, offset, dwarf_cu->GetOffset());
 
   if (!line_table)
 return false;

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Greg Clayton via lldb-commits


@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);

clayborg wrote:

We want all of the time in LLDB to parse and prepare the data, not just the 
parsing time. We use this same variable via `ElapsedTime 
elapsed(m_dwarf.GetDebugInfoParseTimeRef());` in DWARFUnit.cpp to time how long 
it takes to parse and prepare the DIE tree for usage.

So the m_parse_time _is_ intended to be used to measure how long LLDB needs to 
parse the DWARF from the object file _and_ how long it takes to prepare the 
data so it can be used.

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Zequan Wu via lldb-commits


@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);

ZequanWu wrote:

My understanding is m_parse_time is the time spent only on parsing the raw data 
and not about constructing the data structures which will be used by lldb. In 
https://github.com/llvm/llvm-project/blob/b7611370491873722e08e4ce9374312d0c936af1/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L223,
 m_parse_time is used to only track the time spent on parsing a DIE in 
.debug_info, which also doesn't include the time on constructing necessary data 
structures. This change is trying to do the same by narrowing the time to just 
on parsing with llvm.  

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Greg Clayton via lldb-commits


@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);

clayborg wrote:

We want this to stay in this function so it measures all of the work done by 
lldb. `m_parse_time` measures both how long it takes us to parse the 
information, but also should include any needed work to make this data usable 
for LLDB. 

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Greg Clayton via lldb-commits

https://github.com/clayborg requested changes to this pull request.

SymbolFileDWARF::ParseLineTable() does more work after using llvm to parse the 
line table and we still need to measure this. So I believe that the current 
timer was in the correct position. Parse time for DWARF means how long to we 
take to both parse and to cleanup the information for LLDB to use, so the 
entire SymbolFileDWARF::ParseLineTable() function should be measured.

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Greg Clayton via lldb-commits

https://github.com/clayborg edited 
https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread via lldb-commits

github-actions[bot] wrote:



:white_check_mark: With the latest revision this PR passed the Python code 
formatter.

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread via lldb-commits

github-actions[bot] wrote:



:white_check_mark: With the latest revision this PR passed the C/C++ code 
formatter.

https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Zequan Wu (ZequanWu)


Changes

`ParseLineTable` not only parses .debug_line but also constructs `LineTable`.

This moves `m_parse_time` into the the function body of `ParseLLVMLineTable` to 
more accurately reflect parsing time on .debug_line. This also add missing 
timer when parsing `.debug_abbrev`.

---
Full diff: https://github.com/llvm/llvm-project/pull/86568.diff


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+6-4) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 08ce7b82b0c16a..8039a35ed8941c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -145,8 +145,10 @@ static PluginProperties () {
 
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(DWARFContext , llvm::DWARFDebugLine ,
-   dw_offset_t line_offset, dw_offset_t unit_offset) {
+   dw_offset_t line_offset, dw_offset_t unit_offset,
+   StatsDuration _time) {
   Log *log = GetLog(DWARFLog::DebugInfo);
+  ElapsedTime elapsed(parse_time);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF();
   llvm::DWARFContext  = context.GetAsLLVM();
@@ -693,6 +695,7 @@ llvm::DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
   if (debug_abbrev_data.GetByteSize() == 0)
 return nullptr;
 
+  ElapsedTime elapsed(m_parse_time);
   auto abbr =
   std::make_unique(debug_abbrev_data.GetAsLLVM());
   llvm::Error error = abbr->parse();
@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);
   llvm::DWARFDebugLine line;
-  const llvm::DWARFDebugLine::LineTable *line_table =
-  ParseLLVMLineTable(m_context, line, offset, dwarf_cu->GetOffset());
+  const llvm::DWARFDebugLine::LineTable *line_table = ParseLLVMLineTable(
+  m_context, line, offset, dwarf_cu->GetOffset(), m_parse_time);
 
   if (!line_table)
 return false;

``




https://github.com/llvm/llvm-project/pull/86568
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Dwarf] Fix dwarf parse time for line table and .debug_abbrev. (PR #86568)

2024-03-25 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu created 
https://github.com/llvm/llvm-project/pull/86568

`ParseLineTable` not only parses .debug_line but also constructs `LineTable`.

This moves `m_parse_time` into the the function body of `ParseLLVMLineTable` to 
more accurately reflect parsing time on .debug_line. This also add missing 
timer when parsing `.debug_abbrev`.

>From 19dd9a13c21d70b42b9d68aed6fb0b5a5e494685 Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Mon, 25 Mar 2024 15:49:42 -0400
Subject: [PATCH] [lldb][Dwarf] Fix dwarf parse time for line table and
 .debug_abbrev.

---
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 08ce7b82b0c16a..8039a35ed8941c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -145,8 +145,10 @@ static PluginProperties () {
 
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(DWARFContext , llvm::DWARFDebugLine ,
-   dw_offset_t line_offset, dw_offset_t unit_offset) {
+   dw_offset_t line_offset, dw_offset_t unit_offset,
+   StatsDuration _time) {
   Log *log = GetLog(DWARFLog::DebugInfo);
+  ElapsedTime elapsed(parse_time);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVMDWARF();
   llvm::DWARFContext  = context.GetAsLLVM();
@@ -693,6 +695,7 @@ llvm::DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
   if (debug_abbrev_data.GetByteSize() == 0)
 return nullptr;
 
+  ElapsedTime elapsed(m_parse_time);
   auto abbr =
   std::make_unique(debug_abbrev_data.GetAsLLVM());
   llvm::Error error = abbr->parse();
@@ -1228,10 +1231,9 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit 
_unit) {
   if (offset == DW_INVALID_OFFSET)
 return false;
 
-  ElapsedTime elapsed(m_parse_time);
   llvm::DWARFDebugLine line;
-  const llvm::DWARFDebugLine::LineTable *line_table =
-  ParseLLVMLineTable(m_context, line, offset, dwarf_cu->GetOffset());
+  const llvm::DWARFDebugLine::LineTable *line_table = ParseLLVMLineTable(
+  m_context, line, offset, dwarf_cu->GetOffset(), m_parse_time);
 
   if (!line_table)
 return false;

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits