|
AGX Dynamics 2.41.1.2
|
Utility class to time a scope. More...
#include <TimerBlock.h>
Public Types | |
| using | OnDeleteCallback = std::function< void(agx::UInt64, agx::UInt64)> |
Public Member Functions | |
| TimerBlock (OnDeleteCallback onDeleteCallback) | |
| Construct given title. | |
| ~TimerBlock () | |
| Print during destruction. | |
| void | stop () |
| Stop the timer before we leave the scope. | |
Static Public Member Functions | |
| template<typename... ArgsT> | |
| static TimerBlock | create (const agx::String &format, ArgsT &&... args) |
| Create timer block given format string. | |
Utility class to time a scope.
The title and time will be printed while this object is being destructed.
Definition at line 28 of file TimerBlock.h.
| using agxUtil::TimerBlock::OnDeleteCallback = std::function<void( agx::UInt64, agx::UInt64 )> |
Definition at line 31 of file TimerBlock.h.
|
inline |
Construct given title.
Print will be: {Timer Block}: $title
Definition at line 68 of file TimerBlock.h.
|
inline |
Print during destruction.
Definition at line 78 of file TimerBlock.h.
References agx::InvalidIndex, and stop().
|
inlinestatic |
Create timer block given format string.
Example: for ( ... ) { auto tb = agxUtil::TimerBlock::create( "Iteration %d", i + 1 ); }
Will print: {Timer Block}: Iteration 1
Definition at line 52 of file TimerBlock.h.
References agx::Timer::convertToMs(), agx::AgXString< std::string >::format(), and stop().
|
inline |
Stop the timer before we leave the scope.
Definition at line 90 of file TimerBlock.h.
References agx::Timer::getCurrentTick().
Referenced by ~TimerBlock(), and create().