LLVM  14.0.0git
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
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

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

Static Public Member Functions

static void printAll (raw_ostream &OS)
 This static method prints all timers. More...
 
static void clearAll ()
 Clear out all timers. More...
 
static const char * printAllJSONValues (raw_ostream &OS, const char *delim)
 Prints all timers as JSON key/value pairs. More...
 
static void ConstructTimerLists ()
 Ensure global timer group lists are initialized. More...
 
static std::unique_ptr< TimerGroupaquireDefaultGroup ()
 This makes the default group unmanaged, and lets the user manage the group's lifetime. More...
 

Friends

class Timer
 
void PrintStatisticsJSON (raw_ostream &OS)
 Print statistics in JSON format. More...
 

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 176 of file Timer.h.

Constructor & Destructor Documentation

◆ TimerGroup() [1/2]

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

Definition at line 287 of file Timer.cpp.

References TimerGroupList, and TimerLock.

◆ TimerGroup() [2/2]

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

Definition at line 299 of file Timer.cpp.

References assert(), P, and llvm::StringMapImpl::size().

◆ ~TimerGroup()

TimerGroup::~TimerGroup ( )

Definition at line 309 of file Timer.cpp.

References TimerLock.

Member Function Documentation

◆ aquireDefaultGroup()

std::unique_ptr< TimerGroup > TimerGroup::aquireDefaultGroup ( )
static

This makes the default group unmanaged, and lets the user manage the group's lifetime.

Definition at line 507 of file Timer.cpp.

References DefaultTimerGroup.

◆ clear()

void TimerGroup::clear ( )

Clear all timers in this group.

Definition at line 439 of file Timer.cpp.

References 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 452 of file Timer.cpp.

References TimerGroupList, and TimerLock.

◆ ConstructTimerLists()

void TimerGroup::ConstructTimerLists ( )
static

Ensure global timer group lists are initialized.

This function is mostly used by the Statistic code to influence the construction and destruction order of the global timer lists.

Definition at line 503 of file Timer.cpp.

References NamedGroupedTimers.

◆ 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 427 of file Timer.cpp.

References TimerLock.

Referenced by llvm::TimePassesHandler::print().

◆ printAll()

void TimerGroup::printAll ( raw_ostream OS)
static

This static method prints all timers.

Definition at line 445 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 496 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 469 of file Timer.cpp.

References TimerLock.

◆ setName()

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

Definition at line 210 of file Timer.h.

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

Friends And Related Function Documentation

◆ PrintStatisticsJSON

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().

◆ Timer

friend class Timer
friend

Definition at line 245 of file Timer.h.


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