1010
1111#include " lldb/Core/Debugger.h"
1212#include " lldb/Utility/StreamString.h"
13+ #include " llvm/Support/Signposts.h"
1314
1415#include < cstdint>
1516#include < mutex>
@@ -20,6 +21,9 @@ using namespace lldb_private;
2021
2122std::atomic<uint64_t > Progress::g_id (0 );
2223
24+ // Instrument progress events with signposts when supported.
25+ static llvm::ManagedStatic<llvm::SignpostEmitter> g_progress_signposts;
26+
2327Progress::Progress (std::string title, std::string details,
2428 std::optional<uint64_t > total,
2529 lldb_private::Debugger *debugger)
@@ -39,9 +43,15 @@ Progress::Progress(std::string title, std::string details,
3943 // Report to the ProgressManager if that subsystem is enabled.
4044 if (ProgressManager::Enabled ())
4145 ProgressManager::Instance ().Increment (m_progress_data);
46+
47+ // Start signpost interval right before the meaningful work starts.
48+ g_progress_signposts->startInterval (this , m_progress_data.title );
4249}
4350
4451Progress::~Progress () {
52+ // End signpost interval as soon as possible.
53+ g_progress_signposts->endInterval (this , m_progress_data.title );
54+
4555 // Make sure to always report progress completed when this object is
4656 // destructed so it indicates the progress dialog/activity should go away.
4757 std::lock_guard<std::mutex> guard (m_mutex);
0 commit comments