9#ifndef LLDB_TARGET_STATISTICS_H
10#define LLDB_TARGET_STATISTICS_H
17#include "llvm/ADT/StringMap.h"
18#include "llvm/Support/JSON.h"
37 using Duration = std::chrono::duration<double>;
44 void reset() {
value.store(0, std::memory_order_relaxed); }
47 value.fetch_add(std::chrono::duration_cast<InternalDuration>(dur).count(),
48 std::memory_order_relaxed);
100 llvm::json::Value
ToJSON()
const;
108 llvm::json::Value
ToJSON()
const;
137 llvm::json::Value
ToJSON()
const;
197 return m_count.load(std::memory_order_relaxed);
204 llvm::json::Value
ToJSON()
const;
246 return iterator->second;
250 std::make_shared<SummaryStatistics>(provider.
GetName(),
252 return it.first->second;
255 llvm::json::Value
ToJSON();
317 static llvm::json::Value
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
static MemoryStats GetMemoryStats()
static void SetCollectingStats(bool enable)
static bool GetCollectingStats()
static bool g_collecting_stats
static void ResetStatistics(Debugger &debugger, Target *target)
Reset metrics associated with one or all targets in a debugger.
static llvm::json::Value ReportStatistics(Debugger &debugger, Target *target, const lldb_private::StatisticsOptions &options)
Get metrics associated with one or all targets in a debugger in JSON format.
A class to manage flag bits.
A class that measures elapsed time in an exception safe way.
StatsDuration & m_elapsed_time
Elapsed time in seconds to increment when this object goes out of scope.
ElapsedTime(StatsDuration &opt_time)
StatsTimepoint m_start_time
Set to the start time when the object is created.
std::atomic< uint64_t > value
std::chrono::duration< double > Duration
StatsDuration & operator+=(Duration dur)
std::chrono::duration< uint64_t, std::micro > InternalDuration
A class that wraps a std::map of SummaryStatistics objects behind a mutex.
llvm::StringMap< SummaryStatisticsSP > m_summary_stats_map
llvm::json::Value ToJSON()
SummaryStatisticsSP GetSummaryStatisticsForProvider(lldb_private::TypeSummaryImpl &provider)
Get the SummaryStatistics object for a given provider name, or insert if statistics for that provider...
Basic RAII class to increment the summary count when the call is complete.
SummaryStatisticsSP m_stats
SummaryInvocation & operator=(const SummaryInvocation &)=delete
ElapsedTime m_elapsed_time
SummaryInvocation(const SummaryInvocation &)=delete
Delete the copy constructor and assignment operator to prevent accidental double counting.
SummaryInvocation(SummaryStatisticsSP summary_stats)
A class that represents statistics about a TypeSummaryProviders invocations.
double GetTotalTime() const
void OnInvoked() noexcept
const std::string m_impl_type
llvm::json::Value ToJSON() const
std::string GetSummaryKindName() const
SummaryStatistics(std::string name, std::string impl_type)
std::atomic< uint64_t > m_count
std::string GetName() const
uint64_t GetSummaryCount() const
StatsDuration & GetDurationReference()
lldb_private::StatsDuration m_total_time
A class that represents statistics for a since lldb_private::Target.
void IncreaseSourceMapDeduceCount()
void Reset(Target &target)
StatsSuccessFail m_frame_var
std::optional< StatsTimepoint > m_launch_or_attach_time
uint32_t m_source_map_deduce_count
void CollectStats(Target &target)
StatsSuccessFail & GetFrameVariableStats()
llvm::json::Value ToJSON(Target &target, const lldb_private::StatisticsOptions &options)
StatsDuration m_create_time
std::optional< StatsTimepoint > m_first_public_stop_time
void IncreaseSourceRealpathAttemptCount(uint32_t count)
StatsDuration & GetCreateTime()
uint32_t m_source_realpath_compatible_count
void SetFirstPrivateStopTime()
StatsSuccessFail & GetExpressionStats()
StatsSuccessFail m_expr_eval
std::vector< intptr_t > m_module_identifiers
void SetFirstPublicStopTime()
uint32_t m_source_realpath_attempt_count
void SetLaunchOrAttachTime()
void IncreaseSourceRealpathCompatibleCount(uint32_t count)
std::optional< StatsTimepoint > m_first_private_stop_time
virtual std::string GetName()=0
Get the name of the Type Summary Provider, either a C++ class, a summary string, or a script function...
virtual std::string GetSummaryKindName()
Get the name of the kind of Summary Provider, either c++, summary string, script or python.
A class that represents a running process on the host machine.
std::shared_ptr< SummaryStatistics > SummaryStatisticsSP
std::chrono::time_point< StatsClock > StatsTimepoint
std::chrono::high_resolution_clock StatsClock
ConstString::MemoryStats stats
llvm::json::Value ToJSON() const
A class that represents statistics for a since lldb_private::Module.
bool debug_info_index_saved_to_cache
bool debug_info_had_variable_errors
llvm::json::Value ToJSON() const
llvm::StringMap< llvm::json::Value > type_system_stats
bool debug_info_had_incomplete_types
bool symtab_saved_to_cache
std::vector< intptr_t > symfile_modules
bool symtab_loaded_from_cache
bool debug_info_index_loaded_from_cache
bool GetIncludeTranscript() const
bool GetIncludeModules() const
std::optional< bool > m_load_all_debug_info
void SetIncludeTranscript(bool value)
void SetSummaryOnly(bool value)
bool GetSummaryOnly() const
std::optional< bool > m_include_modules
std::optional< bool > m_include_transcript
void SetIncludeModules(bool value)
bool GetIncludeTargets() const
bool GetLoadAllDebugInfo() const
std::optional< bool > m_summary_only
std::optional< bool > m_include_targets
void SetLoadAllDebugInfo(bool value)
void SetIncludeTargets(bool value)
A class to count success/fail statistics.
StatsSuccessFail(llvm::StringRef n)
llvm::json::Value ToJSON() const