-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][progress] Hook up new broadcast bit and progress manager #83069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chelcassanova
merged 1 commit into
llvm:main
from
chelcassanova:progress-hook-up-new-bit
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,11 @@ | |
#ifndef LLDB_CORE_PROGRESS_H | ||
#define LLDB_CORE_PROGRESS_H | ||
|
||
#include "lldb/Utility/ConstString.h" | ||
#include "lldb/lldb-forward.h" | ||
#include "lldb/lldb-types.h" | ||
#include "llvm/ADT/StringMap.h" | ||
#include <atomic> | ||
#include <cstdint> | ||
#include <mutex> | ||
#include <optional> | ||
|
||
|
@@ -97,27 +98,36 @@ class Progress { | |
/// Used to indicate a non-deterministic progress report | ||
static constexpr uint64_t kNonDeterministicTotal = UINT64_MAX; | ||
|
||
/// Data belonging to this Progress event that is used for bookkeeping by | ||
/// ProgressManager. | ||
struct ProgressData { | ||
/// The title of the progress activity, also used as a category. | ||
std::string title; | ||
/// A unique integer identifier for progress reporting. | ||
uint64_t progress_id; | ||
/// The optional debugger ID to report progress to. If this has no value | ||
/// then all debuggers will receive this event. | ||
std::optional<lldb::user_id_t> debugger_id; | ||
}; | ||
|
||
private: | ||
void ReportProgress(); | ||
static std::atomic<uint64_t> g_id; | ||
/// The title of the progress activity. | ||
std::string m_title; | ||
/// More specific information about the current file being displayed in the | ||
/// report. | ||
std::string m_details; | ||
std::mutex m_mutex; | ||
/// A unique integer identifier for progress reporting. | ||
const uint64_t m_id; | ||
/// How much work ([0...m_total]) that has been completed. | ||
uint64_t m_completed; | ||
/// Total amount of work, use a std::nullopt in the constructor for non | ||
/// deterministic progress. | ||
uint64_t m_total; | ||
/// The optional debugger ID to report progress to. If this has no value then | ||
/// all debuggers will receive this event. | ||
std::optional<lldb::user_id_t> m_debugger_id; | ||
std::mutex m_mutex; | ||
/// Set to true when progress has been reported where m_completed == m_total | ||
/// to ensure that we don't send progress updates after progress has | ||
/// completed. | ||
bool m_complete = false; | ||
/// Data needed by the debugger to broadcast a progress event. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion:
|
||
ProgressData m_progress_data; | ||
}; | ||
|
||
/// A class used to group progress reports by category. This is done by using a | ||
|
@@ -130,13 +140,16 @@ class ProgressManager { | |
~ProgressManager(); | ||
|
||
/// Control the refcount of the progress report category as needed. | ||
void Increment(std::string category); | ||
void Decrement(std::string category); | ||
void Increment(const Progress::ProgressData &); | ||
void Decrement(const Progress::ProgressData &); | ||
|
||
static ProgressManager &Instance(); | ||
|
||
static void ReportProgress(const Progress::ProgressData &); | ||
|
||
private: | ||
llvm::StringMap<uint64_t> m_progress_category_map; | ||
llvm::StringMap<std::pair<uint64_t, Progress::ProgressData>> | ||
m_progress_category_map; | ||
std::mutex m_progress_map_mutex; | ||
}; | ||
|
||
|
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.