13#include "llvm/Support/Signposts.h"
29 std::optional<uint64_t> total,
40 std::chrono::nanoseconds(
41 std::chrono::steady_clock::now().time_since_epoch())
44 std::lock_guard<std::mutex> guard(
m_mutex);
57 std::lock_guard<std::mutex> guard(
m_mutex);
63 std::optional<std::string> updated_detail) {
67 m_completed.fetch_add(amount, std::memory_order_relaxed);
70 using namespace std::chrono;
73 uint64_t last_report_time_ns =
77 now = steady_clock::now().time_since_epoch();
82 last_report_time_ns, now.count(), std::memory_order_relaxed,
83 std::memory_order_relaxed));
86 std::lock_guard<std::mutex> guard(
m_mutex);
88 m_details = std::move(updated_detail.value());
static llvm::ManagedStatic< llvm::SignpostEmitter > g_progress_signposts
A class to manage flag bits.
static void ReportProgress(uint64_t progress_id, std::string title, std::string details, uint64_t completed, uint64_t total, std::optional< lldb::user_id_t > debugger_id, uint32_t progress_category_bit=lldb::eBroadcastBitProgress)
Report progress events.
const Timeout< std::nano > m_minimum_report_time
const std::optional< lldb::user_id_t > m_debugger_id
The optional debugger ID to report progress to.
const std::string m_title
The title of the progress activity, also used as a category.
void Increment(uint64_t amount=1, std::optional< std::string > updated_detail={})
Increment the progress and send a notification to the installed callback.
static std::atomic< uint64_t > g_id
const Origin m_origin
The origin of the progress event, whether it is internal or external.
std::atomic< uint64_t > m_last_report_time_ns
Time (in nanoseconds since epoch) of the last progress report.
std::string m_details
More specific information about the current file being displayed in the report.
Origin
Enum to indicate the origin of a progress event, internal or external.
static constexpr uint64_t kNonDeterministicTotal
Used to indicate a non-deterministic progress report.
std::mutex m_mutex
Guards non-const non-atomic members of the class.
const uint64_t m_progress_id
A unique integer identifier for progress reporting.
std::atomic< uint64_t > m_completed
How much work ([0...m_total]) that has been completed.
std::optional< uint64_t > m_prev_completed
The "completed" value of the last reported event.
Progress(std::string title, std::string details={}, std::optional< uint64_t > total=std::nullopt, lldb_private::Debugger *debugger=nullptr, Timeout< std::nano > minimum_report_time=std::nullopt, Origin origin=Origin::eInternal)
Construct a progress object that will report information.
~Progress()
Destroy the progress object.
const uint64_t m_total
Total amount of work, use a std::nullopt in the constructor for non deterministic progress.
A class that represents a running process on the host machine.
@ eBroadcastBitExternalProgress