9#ifndef LLDB_CORE_PROGRESS_H
10#define LLDB_CORE_PROGRESS_H
16#include "llvm/ADT/StringMap.h"
89 Progress(std::string title, std::string details = {},
90 std::optional<uint64_t> total = std::nullopt,
92 Timeout<std::nano> minimum_report_time = std::nullopt,
113 std::optional<std::string> updated_detail = {});
135 static std::atomic<uint64_t>
g_id;
194 void Expire(llvm::StringRef key);
enables scheduling a callback function after a specified timeout.
static constexpr Handle INVALID_HANDLE
A class to manage flag bits.
A class used to group progress reports by category.
void Decrement(const Progress::ProgressData &)
static void ReportProgress(const Progress::ProgressData &progress_data, EventType type)
Alarm m_alarm
Alarm instance to coalesce progress events.
static ProgressManager & Instance()
void Expire(llvm::StringRef key)
Helper function for reporting progress when the alarm in the corresponding entry in the map expires.
static std::optional< ProgressManager > & InstanceImpl()
llvm::StringMap< Entry > m_entries
Map used for bookkeeping.
void Increment(const Progress::ProgressData &)
Control the refcount of the progress report category as needed.
std::mutex m_entries_mutex
Mutex to provide the map.
A Progress indicator helper class.
const Timeout< std::nano > m_minimum_report_time
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
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.
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()
Destroy the progress object.
const ProgressData m_progress_data
Data needed by the debugger to broadcast a progress event.
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.
Entry used for bookkeeping.
Progress::ProgressData data
Data used to emit progress events.
Alarm::Handle handle
Alarm handle used when the refcount reaches zero.
uint64_t refcount
Reference count used for overlapping events.
Data belonging to this Progress event that is used for bookkeeping by ProgressManager.
Origin origin
The origin of the progress event, wheter it is internal or external.
std::optional< lldb::user_id_t > debugger_id
The optional debugger ID to report progress to.
std::string title
The title of the progress activity, also used as a category.
uint64_t progress_id
A unique integer identifier for progress reporting.