[lldb] Emit signpost intervals for progress events (NFC)#108498
Merged
JDevlieghere merged 1 commit intollvm:mainfrom Sep 13, 2024
Merged
[lldb] Emit signpost intervals for progress events (NFC)#108498JDevlieghere merged 1 commit intollvm:mainfrom
JDevlieghere merged 1 commit intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesEmit signpost intervals for progress events so that when users report an operation takes a long time, we can see investigate the issue with Instruments. Full diff: https://github.com/llvm/llvm-project/pull/108498.diff 1 Files Affected:
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index e0ba1a63c508e5..08521a98bf9bbf 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -10,6 +10,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Utility/StreamString.h"
+#include "llvm/Support/Signposts.h"
#include <cstdint>
#include <mutex>
@@ -20,6 +21,9 @@ using namespace lldb_private;
std::atomic<uint64_t> Progress::g_id(0);
+// Instrument progress events with singposts when supported.
+static llvm::ManagedStatic<llvm::SignpostEmitter> g_progress_signposts;
+
Progress::Progress(std::string title, std::string details,
std::optional<uint64_t> total,
lldb_private::Debugger *debugger)
@@ -39,9 +43,15 @@ Progress::Progress(std::string title, std::string details,
// Report to the ProgressManager if that subsystem is enabled.
if (ProgressManager::Enabled())
ProgressManager::Instance().Increment(m_progress_data);
+
+ // Start signpost interval right before the meaningful work starts.
+ g_progress_signposts->startInterval(this, m_progress_data.title);
}
Progress::~Progress() {
+ // End signpost interval as soon as possible.
+ g_progress_signposts->endInterval(this, m_progress_data.title);
+
// Make sure to always report progress completed when this object is
// destructed so it indicates the progress dialog/activity should go away.
std::lock_guard<std::mutex> guard(m_mutex);
|
Emit signpost intervals for progress events so that when users report an operation takes a long time, we can see investigate the issue with Instruments.
6009606 to
d158812
Compare
bulbazord
approved these changes
Sep 13, 2024
JDevlieghere
added a commit
to swiftlang/llvm-project
that referenced
this pull request
Dec 5, 2024
Emit signpost intervals for progress events so that when users report an operation takes a long time, we can investigate the issue with Instruments.app. (cherry picked from commit 90f077c)
JDevlieghere
added a commit
to swiftlang/llvm-project
that referenced
this pull request
Dec 6, 2024
…90f077cba8f4 [🍒 swift/release/6.1] [lldb] Emit signpost intervals for progress events (NFC) (llvm#108498)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emit signpost intervals for progress events so that when users report an operation takes a long time, we can investigate the issue with Instruments.