Go to the documentation of this file.
26 #ifndef LLVM_ADT_STATISTIC_H
27 #define LLVM_ADT_STATISTIC_H
29 #include "llvm/Config/llvm-config.h"
38 #if !defined(NDEBUG) || LLVM_FORCE_ENABLE_STATS
39 #define LLVM_ENABLE_STATS 1
41 #define LLVM_ENABLE_STATS 0
74 Value.store(Val, std::memory_order_relaxed);
79 Value.fetch_add(1, std::memory_order_relaxed);
85 return Value.fetch_add(1, std::memory_order_relaxed);
89 Value.fetch_sub(1, std::memory_order_relaxed);
95 return Value.fetch_sub(1, std::memory_order_relaxed);
101 Value.fetch_add(V, std::memory_order_relaxed);
108 Value.fetch_sub(V, std::memory_order_relaxed);
116 while (V > PrevMax && !
Value.compare_exchange_weak(
117 PrevMax, V, std::memory_order_relaxed)) {
159 #if LLVM_ENABLE_STATS
167 #define STATISTIC(VARNAME, DESC) \
168 static llvm::Statistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}
172 #define ALWAYS_ENABLED_STATISTIC(VARNAME, DESC) \
173 static llvm::TrackingStatistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}
203 const std::vector<std::pair<StringRef, uint64_t>>
GetStatistics();
222 #endif // LLVM_ADT_STATISTIC_H
std::atomic< uint64_t > Value
const std::vector< std::pair< StringRef, uint64_t > > GetStatistics()
Get the statistics.
This is an optimization pass for GlobalISel generic memory operations.
const TrackingStatistic & operator=(uint64_t Val)
const char * getDebugType() const
NoopStatistic(const char *, const char *, const char *)
std::unique_ptr< raw_fd_ostream > CreateInfoOutputFile()
Return a file stream to print our output on.
bool AreStatisticsEnabled()
Check if statistics are enabled.
void RegisterStatistic()
RegisterStatistic - The first time a statistic is bumped, this method is called.
const TrackingStatistic & operator--()
const char * getName() const
const char *const DebugType
const char * getDesc() const
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
uint64_t getValue() const
uint64_t getValue() const
const NoopStatistic & operator=(uint64_t Val)
TrackingStatistic & init()
void EnableStatistics(bool DoPrintOnExit=true)
Enable the collection and printing of statistics.
constexpr TrackingStatistic(const char *DebugType, const char *Name, const char *Desc)
void updateMax(uint64_t V)
void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
const TrackingStatistic & operator-=(uint64_t V)
const TrackingStatistic & operator+=(uint64_t V)
const NoopStatistic & operator++()
std::atomic< bool > Initialized
void ResetStatistics()
Reset the statistics.
void updateMax(uint64_t V)
const NoopStatistic & operator+=(const uint64_t &V)
const NoopStatistic & operator-=(const uint64_t &V)
const NoopStatistic & operator--()
LLVM Value Representation.
const TrackingStatistic & operator++()