LLVM  16.0.0git
Classes | Namespaces | Macros | Typedefs | Functions
Statistic.h File Reference
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Compiler.h"
#include <atomic>
#include <memory>
#include <vector>
Include dependency graph for Statistic.h:

Go to the source code of this file.

Classes

class  llvm::TrackingStatistic
 
class  llvm::NoopStatistic
 

Namespaces

 llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define LLVM_ENABLE_STATS   1
 
#define STATISTIC(VARNAME, DESC)   static llvm::Statistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}
 
#define ALWAYS_ENABLED_STATISTIC(VARNAME, DESC)   static llvm::TrackingStatistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}
 

Typedefs

using llvm::Statistic = TrackingStatistic
 

Functions

void llvm::EnableStatistics (bool DoPrintOnExit=true)
 Enable the collection and printing of statistics. More...
 
bool llvm::AreStatisticsEnabled ()
 Check if statistics are enabled. More...
 
std::unique_ptr< raw_fd_ostreamllvm::CreateInfoOutputFile ()
 Return a file stream to print our output on. More...
 
void llvm::PrintStatistics ()
 Print statistics to the file returned by CreateInfoOutputFile(). More...
 
void llvm::PrintStatistics (raw_ostream &OS)
 Print statistics to the given output stream. More...
 
void llvm::PrintStatisticsJSON (raw_ostream &OS)
 Print statistics in JSON format. More...
 
std::vector< std::pair< StringRef, uint64_t > > llvm::GetStatistics ()
 Get the statistics. More...
 
void llvm::ResetStatistics ()
 Reset the statistics. More...
 

Detailed Description

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metrics from passes. These statistics are printed at the end of a run (from llvm_shutdown), when the -stats command line option is passed on the command line.

This is useful for reporting information like the number of instructions simplified, optimized or removed by various transformations, like this:

static Statistic NumInstsKilled("gcse", "Number of instructions killed");

Later, in the code: ++NumInstsKilled;

NOTE: Statistics must be declared as global variables.

Definition in file Statistic.h.

Macro Definition Documentation

◆ ALWAYS_ENABLED_STATISTIC

#define ALWAYS_ENABLED_STATISTIC (   VARNAME,
  DESC 
)    static llvm::TrackingStatistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}

Definition at line 172 of file Statistic.h.

◆ LLVM_ENABLE_STATS

#define LLVM_ENABLE_STATS   1

Definition at line 39 of file Statistic.h.

◆ STATISTIC

#define STATISTIC (   VARNAME,
  DESC 
)    static llvm::Statistic VARNAME = {DEBUG_TYPE, #VARNAME, DESC}

Definition at line 167 of file Statistic.h.