class Timer

Declaration

class Timer { /* full declaration omitted */ };

Description

This class is used to track the amount of time spent between invocations of its startTimer()/stopTimer() methods. Given appropriate OS support it can also keep track of the RSS of the program at various points. By default, the Timer will print the amount of time it has captured to standard error when the last timer is destroyed, otherwise it is printed when its TimerGroup is destroyed. Timers do not print their information if they are never started.

Declared at: llvm/include/llvm/Support/Timer.h:81

Member Variables

private llvm::TimeRecord Time
The total time captured.
private llvm::TimeRecord StartTime
The time startTimer() was last called.
private std::string Name
The name of this time variable.
private std::string Description
Description of this time variable.
private bool Running = false
Is the timer currently running?
private bool Triggered = false
Has the timer ever been triggered?
private llvm::TimerGroup* TG = nullptr
The TimerGroup this Timer is in.
private llvm::Timer** Prev = nullptr
Pointer to \p Next of previous timer in group.
private llvm::Timer* Next = nullptr
Next timer in the group.

Method Overview

  • public Timer(llvm::StringRef TimerName, llvm::StringRef TimerDescription)
  • public Timer(llvm::StringRef TimerName, llvm::StringRef TimerDescription, llvm::TimerGroup & tg)
  • public Timer(const llvm::Timer & RHS)
  • public Timer()
  • public void clear()
  • public const std::string & getDescription() const
  • public const std::string & getName() const
  • public llvm::TimeRecord getTotalTime() const
  • public bool hasTriggered() const
  • public void init(llvm::StringRef TimerName, llvm::StringRef TimerDescription)
  • public void init(llvm::StringRef TimerName, llvm::StringRef TimerDescription, llvm::TimerGroup & tg)
  • public bool isInitialized() const
  • public bool isRunning() const
  • public void startTimer()
  • public void stopTimer()
  • public ~Timer()

Methods

Timer(llvm::StringRef TimerName,
      llvm::StringRef TimerDescription)

Declared at: llvm/include/llvm/Support/Timer.h:93

Parameters

llvm::StringRef TimerName
llvm::StringRef TimerDescription

Timer(llvm::StringRef TimerName,
      llvm::StringRef TimerDescription,
      llvm::TimerGroup& tg)

Declared at: llvm/include/llvm/Support/Timer.h:96

Parameters

llvm::StringRef TimerName
llvm::StringRef TimerDescription
llvm::TimerGroup& tg

Timer(const llvm::Timer& RHS)

Declared at: llvm/include/llvm/Support/Timer.h:99

Parameters

const llvm::Timer& RHS

Timer()

Description

Create an uninitialized timer, client must use 'init'.

Declared at: llvm/include/llvm/Support/Timer.h:109

void clear()

Description

Clear the timer state.

Declared at: llvm/include/llvm/Support/Timer.h:132

const std::string& getDescription() const

Declared at: llvm/include/llvm/Support/Timer.h:114

const std::string& getName() const

Declared at: llvm/include/llvm/Support/Timer.h:113

llvm::TimeRecord getTotalTime() const

Description

Return the duration for which this timer has been running.

Declared at: llvm/include/llvm/Support/Timer.h:135

bool hasTriggered() const

Description

Check if startTimer() has ever been called on this timer.

Declared at: llvm/include/llvm/Support/Timer.h:121

void init(llvm::StringRef TimerName,
          llvm::StringRef TimerDescription)

Declared at: llvm/include/llvm/Support/Timer.h:110

Parameters

llvm::StringRef TimerName
llvm::StringRef TimerDescription

void init(llvm::StringRef TimerName,
          llvm::StringRef TimerDescription,
          llvm::TimerGroup& tg)

Declared at: llvm/include/llvm/Support/Timer.h:111

Parameters

llvm::StringRef TimerName
llvm::StringRef TimerDescription
llvm::TimerGroup& tg

bool isInitialized() const

Declared at: llvm/include/llvm/Support/Timer.h:115

bool isRunning() const

Description

Check if the timer is currently running.

Declared at: llvm/include/llvm/Support/Timer.h:118

void startTimer()

Description

Start the timer running. Time between calls to startTimer/stopTimer is counted by the Timer class. Note that these calls must be correctly paired.

Declared at: llvm/include/llvm/Support/Timer.h:126

void stopTimer()

Description

Stop the timer.

Declared at: llvm/include/llvm/Support/Timer.h:129

~Timer()

Declared at: llvm/include/llvm/Support/Timer.h:106