LLVM 22.0.0git
llvm::TimerGroup Class Reference

The TimerGroup class is used to group together related timers into a single report that is printed when the TimerGroup is destroyed. More...

#include "llvm/Support/Timer.h"

Public Member Functions

LLVM_ABI TimerGroup (StringRef Name, StringRef Description)
LLVM_ABI TimerGroup (StringRef Name, StringRef Description, const StringMap< TimeRecord > &Records)
LLVM_ABI ~TimerGroup ()
void setName (StringRef NewName, StringRef NewDescription)
LLVM_ABI void print (raw_ostream &OS, bool ResetAfterPrint=false)
 Print any started timers in this group, optionally resetting timers after printing them.
LLVM_ABI void clear ()
 Clear all timers in this group.
LLVM_ABI const charprintJSONValues (raw_ostream &OS, const char *delim)

Static Public Member Functions

static LLVM_ABI void printAll (raw_ostream &OS)
 This static method prints all timers.
static LLVM_ABI void clearAll ()
 Clear out all timers.
static LLVM_ABI const charprintAllJSONValues (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.
static LLVM_ABI void * acquireTimerGlobals ()
 This makes the timer globals unmanaged, and lets the user manage the lifetime.

Friends

class TimerGlobals
class Timer
LLVM_ABI friend void PrintStatisticsJSON (raw_ostream &OS)
 Print statistics in JSON format.

Detailed Description

The TimerGroup class is used to group together related timers into a single report that is printed when the TimerGroup is destroyed.

It is illegal to destroy a TimerGroup object before all of the Timers in it are gone. A TimerGroup can be specified for a newly created timer in its constructor.

Definition at line 186 of file Timer.h.

Constructor & Destructor Documentation

◆ TimerGroup() [1/2]

TimerGroup::TimerGroup ( StringRef Name,
StringRef Description )
explicit

Definition at line 284 of file Timer.cpp.

References timerLock().

◆ TimerGroup() [2/2]

TimerGroup::TimerGroup ( StringRef Name,
StringRef Description,
const StringMap< TimeRecord > & Records )
explicit

Definition at line 287 of file Timer.cpp.

References assert(), for(), P, and llvm::SmallVectorTemplateCommon< T, typename >::size().

◆ ~TimerGroup()

TimerGroup::~TimerGroup ( )

Definition at line 297 of file Timer.cpp.

References llvm::CreateInfoOutputFile(), and timerLock().

Member Function Documentation

◆ acquireTimerGlobals()

void * TimerGroup::acquireTimerGlobals ( )
static

This makes the timer globals unmanaged, and lets the user manage the lifetime.

Definition at line 559 of file Timer.cpp.

References ManagedTimerGlobals.

◆ clear()

void TimerGroup::clear ( )

Clear all timers in this group.

Definition at line 423 of file Timer.cpp.

References T, Timer, and timerLock().

◆ clearAll()

void TimerGroup::clearAll ( )
static

Clear out all timers.

This is mostly used to disable automatic printing on shutdown, when timers have already been printed explicitly using printAll or printJSONValues.

Definition at line 436 of file Timer.cpp.

References TimerGroupList, and timerLock().

◆ constructForStatistics()

void TimerGroup::constructForStatistics ( )
static

Ensure global objects required for statistics printing are initialized.

This function is used by the Statistic code to ensure correct order of global constructors and destructors.

Definition at line 555 of file Timer.cpp.

References ManagedTimerGlobals.

◆ print()

void TimerGroup::print ( raw_ostream & OS,
bool ResetAfterPrint = false )

Print any started timers in this group, optionally resetting timers after printing them.

Definition at line 411 of file Timer.cpp.

References timerLock().

◆ printAll()

void TimerGroup::printAll ( raw_ostream & OS)
static

This static method prints all timers.

Definition at line 429 of file Timer.cpp.

References TimerGroupList, and timerLock().

◆ printAllJSONValues()

const char * TimerGroup::printAllJSONValues ( raw_ostream & OS,
const char * delim )
static

Prints all timers as JSON key/value pairs.

Definition at line 476 of file Timer.cpp.

References TimerGroupList, and timerLock().

Referenced by llvm::PrintStatisticsJSON().

◆ printJSONValues()

const char * TimerGroup::printJSONValues ( raw_ostream & OS,
const char * delim )

Definition at line 449 of file Timer.cpp.

References T, and timerLock().

◆ setName()

void llvm::TimerGroup::setName ( StringRef NewName,
StringRef NewDescription )
inline

Definition at line 224 of file Timer.h.

References llvm::StringRef::begin(), and llvm::StringRef::end().

◆ PrintStatisticsJSON

LLVM_ABI friend void PrintStatisticsJSON ( raw_ostream & OS)
friend

Print statistics in JSON format.

This does include all global timers (

See also
Timer, TimerGroup). Note that the timers are cleared after printing and will not be printed in human readable form or in a second call of PrintStatisticsJSON().

References LLVM_ABI, T, and Timer.

◆ Timer

friend class Timer
friend

Definition at line 260 of file Timer.h.

References Timer.

Referenced by clear(), PrintStatisticsJSON, and Timer.

◆ TimerGlobals

friend class TimerGlobals
friend

Definition at line 212 of file Timer.h.

References LLVM_ABI, and TimerGlobals.

Referenced by TimerGlobals.


The documentation for this class was generated from the following files: