MLIR 24.0.0git
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)
Timer & operator= (Timer &&other)
 operator bool () const
 Returns whether this is a valid timer handle.
bool isThreadSafe () const
 Whether the timing manager supports concurrent timer operations.
void start ()
 Start the timer.
void stop ()
 Stop the timer.
Timer nest (const void *id, function_ref< std::string()> nameBuilder)
 Create a child timer nested within this one.
Timer nest (TimingIdentifier name)
 See above.
Timer nest (StringRef name)
 See above.
void hide ()
 Hide the timer in timing reports and directly show its children.

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 192 of file Timing.h.

Constructor & Destructor Documentation

◆ Timer() [1/4]

mlir::Timer::Timer ( )
default

Referenced by nest(), nest(), nest(), operator=(), Timer(), and Timer().

◆ Timer() [2/4]

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

References Timer().

◆ Timer() [3/4]

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

Definition at line 196 of file Timing.h.

References Timer().

◆ Timer() [4/4]

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

Definition at line 262 of file Timing.h.

References TimingManager.

Member Function Documentation

◆ hide()

void mlir::Timer::hide ( )
inline

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

Definition at line 256 of file Timing.h.

◆ isThreadSafe()

bool mlir::Timer::isThreadSafe ( ) const
inline

Whether the timing manager supports concurrent timer operations.

Definition at line 215 of file Timing.h.

◆ 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 240 of file Timing.h.

References Timer().

Referenced by nest(), and nest().

◆ nest() [2/3]

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

See above.

Definition at line 251 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 245 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 212 of file Timing.h.

◆ operator=()

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

Definition at line 201 of file Timing.h.

References Timer().

◆ 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 219 of file Timing.h.

◆ 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 226 of file Timing.h.

◆ TimingManager

friend class TimingManager
friend

Definition at line 265 of file Timing.h.

References TimingManager.

Referenced by Timer(), and TimingManager.


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