Skip to content

Commit 799e905

Browse files
authored
[lldb] Create a default rate limit constant in Progress (NFC) (#133506)
In #133211, Greg suggested making the rate limit configurable through a setting. Although adding the setting is easy, the two places where we currently use rate limiting aren't tied to a particular debugger. Although it'd be possible to hook up, given how few progress events currently implement rate limiting, I don't think it's worth threading this through, if that's even possible. I still think it's a good idea to be consistent and make it easy to pick the same rate limiting value, so I've moved it into a constant in the Progress class.
1 parent bd862a4 commit 799e905

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lldb/include/lldb/Core/Progress.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ class Progress {
115115
/// Used to indicate a non-deterministic progress report
116116
static constexpr uint64_t kNonDeterministicTotal = UINT64_MAX;
117117

118+
/// The default report time for high frequency progress reports.
119+
static constexpr std::chrono::milliseconds kDefaultHighFrequencyReportTime =
120+
std::chrono::milliseconds(20);
121+
118122
private:
119123
void ReportProgress();
120124
static std::atomic<uint64_t> g_id;

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void ManualDWARFIndex::Index() {
8181
const uint64_t total_progress = units_to_index.size() * 2 + 8;
8282
Progress progress("Manually indexing DWARF", module_desc.GetData(),
8383
total_progress, /*debugger=*/nullptr,
84-
/*minimum_report_time=*/std::chrono::milliseconds(20));
84+
Progress::kDefaultHighFrequencyReportTime);
8585

8686
// Share one thread pool across operations to avoid the overhead of
8787
// recreating the threads.

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ void SymbolFileDWARFDebugMap::ForEachSymbolFile(
724724
const size_t num_oso_idxs = m_compile_unit_infos.size();
725725
Progress progress(std::move(description), "", num_oso_idxs,
726726
/*debugger=*/nullptr,
727-
/*minimum_report_time=*/std::chrono::milliseconds(20));
727+
Progress::kDefaultHighFrequencyReportTime);
728728
for (uint32_t oso_idx = 0; oso_idx < num_oso_idxs; ++oso_idx) {
729729
if (SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx)) {
730730
progress.Increment(oso_idx, oso_dwarf->GetObjectFile()

0 commit comments

Comments
 (0)