MLIR  19.0.0git
Public Member Functions | Protected Member Functions | Friends | List of all members
mlir::Timer Class Reference

A handle for a timer in a TimingManager. More...

#include "mlir/Support/Timing.h"

Public Member Functions

 Timer ()=default
 
 Timer (const Timer &other)=default
 
 Timer (Timer &&other)
 
Timeroperator= (Timer &&other)
 
 operator bool () const
 Returns whether this is a valid timer handle. More...
 
void start ()
 Start the timer. More...
 
void stop ()
 Stop the timer. More...
 
Timer nest (const void *id, function_ref< std::string()> nameBuilder)
 Create a child timer nested within this one. More...
 
Timer nest (TimingIdentifier name)
 See above. More...
 
Timer nest (StringRef name)
 See above. More...
 
void hide ()
 Hide the timer in timing reports and directly show its children. More...
 

Protected Member Functions

 Timer (TimingManager &tm, void *handle)
 

Friends

class TimingManager
 

Detailed Description

A handle for a timer in a TimingManager.

This class encapsulates a pointer to a TimingManager and an opaque handle to a timer running within that manager. Libraries and infrastructure code operate on Timer rather than any concrete classes handed out by custom manager implementations.

Definition at line 186 of file Timing.h.

Constructor & Destructor Documentation

◆ Timer() [1/4]

mlir::Timer::Timer ( )
default

Referenced by nest().

◆ Timer() [2/4]

mlir::Timer::Timer ( const Timer other)
default

◆ Timer() [3/4]

mlir::Timer::Timer ( Timer &&  other)
inline

Definition at line 190 of file Timing.h.

◆ Timer() [4/4]

mlir::Timer::Timer ( TimingManager tm,
void *  handle 
)
inlineprotected

Definition at line 253 of file Timing.h.

Member Function Documentation

◆ hide()

void mlir::Timer::hide ( )
inline

Hide the timer in timing reports and directly show its children.

Definition at line 247 of file Timing.h.

References mlir::TimingManager::hideTimer().

Referenced by mlir::TimingScope::hide().

◆ nest() [1/3]

Timer mlir::Timer::nest ( const void *  id,
function_ref< std::string()>  nameBuilder 
)
inline

Create a child timer nested within this one.

Multiple calls to this function with the same unique identifier id will return the same child timer. The timer must have been started when calling this function.

This function can be called from other threads, as long as this timer is not stopped before any uses of the child timer on the other thread are stopped.

The nameBuilder function is not guaranteed to be called.

Definition at line 231 of file Timing.h.

References mlir::TimingManager::nestTimer(), and Timer().

Referenced by mlir::TimingScope::nest(), and nest().

◆ nest() [2/3]

Timer mlir::Timer::nest ( StringRef  name)
inline

See above.

Definition at line 242 of file Timing.h.

References mlir::TimingIdentifier::get(), nest(), and Timer().

◆ nest() [3/3]

Timer mlir::Timer::nest ( TimingIdentifier  name)
inline

See above.

Definition at line 236 of file Timing.h.

References mlir::TimingIdentifier::getAsOpaquePointer(), nest(), and Timer().

◆ operator bool()

mlir::Timer::operator bool ( ) const
inlineexplicit

Returns whether this is a valid timer handle.

Invalid timer handles are used when timing is disabled in the TimingManager to keep the impact on performance low.

Definition at line 206 of file Timing.h.

◆ operator=()

Timer& mlir::Timer::operator= ( Timer &&  other)
inline

Definition at line 195 of file Timing.h.

◆ start()

void mlir::Timer::start ( )
inline

Start the timer.

This must be accompanied by a corresponding call to stop() at a later point.

Definition at line 210 of file Timing.h.

References mlir::TimingManager::startTimer().

Referenced by mlir::TimingScope::TimingScope().

◆ stop()

void mlir::Timer::stop ( )
inline

Stop the timer.

This must have been preceded by a corresponding call to start() at an earlier point.

Definition at line 217 of file Timing.h.

References mlir::TimingManager::stopTimer().

Referenced by mlir::TimingScope::stop().

Friends And Related Function Documentation

◆ TimingManager

friend class TimingManager
friend

Definition at line 256 of file Timing.h.


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