SPH
Public Member Functions | List of all members
ScopedTimer Struct Reference

Timer that reports the measured duration when being destroyed. More...

#include <Profiler.h>

Public Member Functions

 ScopedTimer (const std::string &name, const OnScopeEnds &callback)
 
 ~ScopedTimer ()
 
void stop ()
 
void resume ()
 
void next (const std::string &newName)
 

Detailed Description

Timer that reports the measured duration when being destroyed.

If measured scope is executed by multiple thread at once, the total time is equal to the sum of all per-thread times.

Definition at line 22 of file Profiler.h.

Constructor & Destructor Documentation

◆ ScopedTimer()

ScopedTimer::ScopedTimer ( const std::string &  name,
const OnScopeEnds &  callback 
)
inline

Creates a scoped time.

Parameters
nameUser-defined name of the timer.
callbackFunction called when the timer goes out of scoped. The timer passes its name and elapsed time as parameters of the function.

Definition at line 35 of file Profiler.h.

◆ ~ScopedTimer()

ScopedTimer::~ScopedTimer ( )
inline

Definition at line 39 of file Profiler.h.

Member Function Documentation

◆ next()

void ScopedTimer::next ( const std::string &  newName)
inline

Definition at line 51 of file Profiler.h.

◆ resume()

void ScopedTimer::resume ( )
inline

Definition at line 47 of file Profiler.h.

◆ stop()

void ScopedTimer::stop ( )
inline

Definition at line 43 of file Profiler.h.


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