[Lldb-commits] [lldb] [lldb] Create a default rate limit constant in Progress (NFC) (PR #133506)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 28 11:57:54 PDT 2025
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/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.
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.
>From 497d45360ad50ae909d946b4a34b55346c56ff69 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 28 Mar 2025 11:55:23 -0700
Subject: [PATCH] [lldb] Create a default rate limit constant in Progress (NFC)
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.
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.
---
lldb/include/lldb/Core/Progress.h | 4 ++++
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 +-
.../Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 3 +--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lldb/include/lldb/Core/Progress.h b/lldb/include/lldb/Core/Progress.h
index 3003568e8946b..104a8c0feb80a 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -115,6 +115,10 @@ class Progress {
/// Used to indicate a non-deterministic progress report
static constexpr uint64_t kNonDeterministicTotal = UINT64_MAX;
+ /// The default rate limit for high frequency progress reports.
+ static constexpr std::chrono::milliseconds kDefaultRateLimit =
+ std::chrono::milliseconds(20);
+
private:
void ReportProgress();
static std::atomic<uint64_t> g_id;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 6f2c45e74132c..f6304a7a4b9ba 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -81,7 +81,7 @@ void ManualDWARFIndex::Index() {
const uint64_t total_progress = units_to_index.size() * 2 + 8;
Progress progress("Manually indexing DWARF", module_desc.GetData(),
total_progress, /*debugger=*/nullptr,
- /*minimum_report_time=*/std::chrono::milliseconds(20));
+ Progress::kDefaultRateLimit);
// Share one thread pool across operations to avoid the overhead of
// recreating the threads.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index e346d588a449f..8b72c96dc6f33 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -723,8 +723,7 @@ void SymbolFileDWARFDebugMap::ForEachSymbolFile(
std::function<IterationAction(SymbolFileDWARF &)> closure) {
const size_t num_oso_idxs = m_compile_unit_infos.size();
Progress progress(std::move(description), "", num_oso_idxs,
- /*debugger=*/nullptr,
- /*minimum_report_time=*/std::chrono::milliseconds(20));
+ /*debugger=*/nullptr, Progress::kDefaultRateLimit);
for (uint32_t oso_idx = 0; oso_idx < num_oso_idxs; ++oso_idx) {
if (SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx)) {
progress.Increment(oso_idx, oso_dwarf->GetObjectFile()
More information about the lldb-commits
mailing list