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