26 #ifndef LLVM_ADT_STATISTIC_H
27 #define LLVM_ADT_STATISTIC_H
47 unsigned getValue()
const {
return Value.load(std::memory_order_relaxed); }
53 void construct(
const char *debugtype,
const char *
name,
const char *desc) {
64 #if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
66 Value.store(Val, std::memory_order_relaxed);
71 Value.fetch_add(1, std::memory_order_relaxed);
77 return Value.fetch_add(1, std::memory_order_relaxed);
81 Value.fetch_sub(1, std::memory_order_relaxed);
87 return Value.fetch_sub(1, std::memory_order_relaxed);
93 Value.fetch_add(V, std::memory_order_relaxed);
100 Value.fetch_sub(V, std::memory_order_relaxed);
104 #else // Statistics are disabled in release builds.
126 const Statistic &
operator+=(
const unsigned &V) {
130 const Statistic &
operator-=(
const unsigned &V) {
134 #endif // !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
150 #define STATISTIC(VARNAME, DESC) \
151 static llvm::Statistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC, {0}, false}
176 #endif // LLVM_ADT_STATISTIC_H
std::atomic< unsigned > Value
const Statistic & operator=(unsigned Val)
void EnableStatistics(bool PrintOnExit=true)
Enable the collection and printing of statistics.
void construct(const char *debugtype, const char *name, const char *desc)
construct - This should only be called for non-global statistics.
void RegisterStatistic()
RegisterStatistic - The first time a statistic is bumped, this method is called.
const Statistic & operator+=(unsigned V)
const char * getDebugType() const
const Statistic & operator++()
const Statistic & operator--()
std::unique_ptr< raw_fd_ostream > CreateInfoOutputFile()
Return a file stream to print our output on.
#define TsanHappensAfter(cv)
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
const Statistic & operator-=(unsigned V)
const char * getDesc() const
unsigned getValue() const
const char * getName() const
void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
LLVM Value Representation.
bool AreStatisticsEnabled()
Check if statistics are enabled.