43 cl::desc(
"Enable statistics output from program (available with Asserts)"));
47 cl::desc(
"Display statistics as json data"));
57 std::vector<const Statistic*>
Stats;
96 StatisticInfo::StatisticInfo() {
102 StatisticInfo::~StatisticInfo() {
119 if (
int Cmp = std::strcmp(LHS->
getDebugType(), RHS->getDebugType()))
122 if (
int Cmp = std::strcmp(LHS->
getName(), RHS->getName()))
125 return std::strcmp(LHS->
getDesc(), RHS->getDesc()) < 0;
133 unsigned MaxDebugTypeLen = 0, MaxValLen = 0;
134 for (
size_t i = 0, e = Stats.Stats.size(); i != e; ++i) {
136 (
unsigned)
utostr(Stats.Stats[i]->getValue()).size());
137 MaxDebugTypeLen =
std::max(MaxDebugTypeLen,
138 (
unsigned)std::strlen(Stats.Stats[i]->getDebugType()));
144 OS <<
"===" << std::string(73,
'-') <<
"===\n"
145 <<
" ... Statistics Collected ...\n"
146 <<
"===" << std::string(73,
'-') <<
"===\n\n";
149 for (
size_t i = 0, e = Stats.Stats.size(); i != e; ++i)
150 OS <<
format(
"%*u %-*s - %s\n",
151 MaxValLen, Stats.Stats[i]->getValue(),
152 MaxDebugTypeLen, Stats.Stats[i]->getDebugType(),
153 Stats.Stats[i]->getDesc());
166 const char *delim =
"";
167 for (
const Statistic *Stat : Stats.Stats) {
170 "Statistic group/type name is simple.");
184 #if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
188 if (Stats.Stats.empty())
return;
204 (*OutStream) <<
"Statistics are disabled. "
205 <<
"Build with asserts or with -DLLVM_ENABLE_STATS\n";
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
void EnableStatistics(bool PrintOnExit=true)
Enable the collection and printing of statistics.
static cl::opt< bool > StatsAsJSON("stats-json", cl::desc("Display statistics as json data"))
void RegisterStatistic()
RegisterStatistic - The first time a statistic is bumped, this method is called.
bool needsQuotes(StringRef S)
static cl::opt< bool > Stats("stats", cl::desc("Enable statistics output from program (available with Asserts)"))
-stats - Command line option to cause transformations to emit stats about what they did...
const char * getDebugType() const
static ManagedStatic< StatisticInfo > StatInfo
static std::string utostr(uint64_t X, bool isNeg=false)
std::unique_ptr< raw_fd_ostream > CreateInfoOutputFile()
Return a file stream to print our output on.
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
#define TsanHappensBefore(cv)
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
#define TsanIgnoreWritesBegin()
#define TsanIgnoreWritesEnd()
const char * getDesc() const
unsigned getValue() const
const char * getName() const
static const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs, and clears them all out.
void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void ConstructTimerLists()
Ensure global timer group lists are initialized.
This class implements an extremely fast bulk output stream that can only output to a stream...
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
static ManagedStatic< sys::SmartMutex< true > > StatLock
bool AreStatisticsEnabled()
Check if statistics are enabled.