53          "Enable statistics output from program (available with Asserts)"),
 
   56      "stats-json", 
cl::desc(
"Display statistics as json data"),
 
 
   67  std::vector<TrackingStatistic *> 
Stats;
 
   76  using const_iterator = std::vector<TrackingStatistic *>::const_iterator;
 
   83  const_iterator 
begin()
 const { 
return Stats.begin(); }
 
   84  const_iterator 
end()
 const { 
return Stats.end(); }
 
   85  iterator_range<const_iterator> statistics()
 const {
 
  107  if (!
Initialized.load(std::memory_order_relaxed)) {
 
  115      SI.addStatistic(
this);
 
  118    Initialized.store(
true, std::memory_order_release);
 
 
  122StatisticInfo::StatisticInfo() {
 
  129StatisticInfo::~StatisticInfo() {
 
  141void StatisticInfo::sort() {
 
  144        if (
int Cmp = std::strcmp(
LHS->getDebugType(), 
RHS->getDebugType()))
 
  147        if (
int Cmp = std::strcmp(
LHS->getName(), 
RHS->getName()))
 
  150        return std::strcmp(
LHS->getDesc(), 
RHS->getDesc()) < 0;
 
  154void StatisticInfo::reset() {
 
  161  for (
auto *Stat : 
Stats) {
 
  164    Stat->Initialized = 
false;
 
  180  unsigned MaxDebugTypeLen = 0, MaxValLen = 0;
 
  182    MaxValLen = std::max(MaxValLen, (
unsigned)
utostr(Stat->
getValue()).size());
 
  184        std::max(MaxDebugTypeLen, (
unsigned)std::strlen(Stat->
getDebugType()));
 
  190  OS << 
"===" << std::string(73, 
'-') << 
"===\n" 
  191     << 
"                          ... Statistics Collected ...\n" 
  192     << 
"===" << std::string(73, 
'-') << 
"===\n\n";
 
  196    OS << 
format(
"%*" PRIu64 
" %-*s - %s\n", MaxValLen, Stat->
getValue(),
 
 
  211  const char *delim = 
"";
 
  215           "Statistic group/type name is simple.");
 
  217           "Statistic name is simple");
 
 
  235  if (
Stats.Stats.empty()) 
return;
 
  251    (*OutStream) << 
"Statistics are disabled.  " 
  252                 << 
"Build with asserts or with -DLLVM_FORCE_ENABLE_STATS\n";
 
 
  259  std::vector<std::pair<StringRef, uint64_t>> ReturnStats;
 
  261  for (
const auto &Stat : 
StatInfo->statistics())
 
  262    ReturnStats.emplace_back(Stat->getName(), Stat->getValue());
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
block placement Basic Block Placement Stats
 
static bool EnableStats
-stats - Command line option to cause transformations to emit stats about what they did.
 
static ManagedStatic< StatisticInfo > StatInfo
 
static ManagedStatic< sys::SmartMutex< true > > StatLock
 
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
 
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
 
static LLVM_ABI const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs.
 
static LLVM_ABI void constructForStatistics()
Ensure global objects required for statistics printing are initialized.
 
const char * getDesc() const
 
uint64_t getValue() const
 
const char * getDebugType() const
 
const char * getName() const
 
std::atomic< bool > Initialized
 
LLVM_ABI void RegisterStatistic()
RegisterStatistic - The first time a statistic is bumped, this method is called.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
 
LocationClass< Ty > location(Ty &L)
 
LLVM_ABI iterator begin() const
 
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
 
QuotingType needsQuotes(StringRef S, bool ForcePreserveAsString=true)
 
This is an optimization pass for GlobalISel generic memory operations.
 
void stable_sort(R &&Range)
 
LLVM_ABI std::unique_ptr< raw_ostream > CreateInfoOutputFile()
Return a stream to print our output on.
 
LLVM_ABI void ResetStatistics()
Reset the statistics.
 
std::string utostr(uint64_t X, bool isNeg=false)
 
LLVM_ABI void EnableStatistics(bool DoPrintOnExit=true)
Enable the collection and printing of statistics.
 
void sort(IteratorTy Start, IteratorTy End)
 
LLVM_ABI bool AreStatisticsEnabled()
Check if statistics are enabled.
 
void initStatisticOptions()
 
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
 
LLVM_ABI void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
 
LLVM_ABI std::vector< std::pair< StringRef, uint64_t > > GetStatistics()
Get the statistics.
 
LLVM_ABI void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.