10
10
11
11
#include " lldb/Core/Debugger.h"
12
12
#include " lldb/Utility/StreamString.h"
13
+ #include " llvm/Support/Signposts.h"
13
14
14
15
#include < cstdint>
15
16
#include < mutex>
@@ -20,6 +21,9 @@ using namespace lldb_private;
20
21
21
22
std::atomic<uint64_t > Progress::g_id (0 );
22
23
24
+ // Instrument progress events with signposts when supported.
25
+ static llvm::ManagedStatic<llvm::SignpostEmitter> g_progress_signposts;
26
+
23
27
Progress::Progress (std::string title, std::string details,
24
28
std::optional<uint64_t > total,
25
29
lldb_private::Debugger *debugger)
@@ -39,9 +43,15 @@ Progress::Progress(std::string title, std::string details,
39
43
// Report to the ProgressManager if that subsystem is enabled.
40
44
if (ProgressManager::Enabled ())
41
45
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 );
42
49
}
43
50
44
51
Progress::~Progress () {
52
+ // End signpost interval as soon as possible.
53
+ g_progress_signposts->endInterval (this , m_progress_data.title );
54
+
45
55
// Make sure to always report progress completed when this object is
46
56
// destructed so it indicates the progress dialog/activity should go away.
47
57
std::lock_guard<std::mutex> guard (m_mutex);
0 commit comments