|
QuasarEngine
Cross-platform 3D engine and editor
|
Measures the time between its creation and the end of its scope, then logs it as an engine info message. More...
#include <quasar/core/ScopedTimer.h>
Public Member Functions | |
| ScopedTimer (std::string name) | |
| Starts measuring right away. | |
| ~ScopedTimer () | |
| Logs the name and the time elapsed since the creation, in milliseconds. | |
| ScopedTimer (const ScopedTimer &)=delete | |
| ScopedTimer & | operator= (const ScopedTimer &)=delete |
| ScopedTimer (ScopedTimer &&)=delete | |
| ScopedTimer & | operator= (ScopedTimer &&)=delete |
Measures the time between its creation and the end of its scope, then logs it as an engine info message.
The timer starts in the constructor and the time is logged in the destructor, so the scope does the work. The message has the form <name> took <time> ms:
{ ScopedTimer timer("LoadScene"); LoadScene(); }
To measure a scope in Debug only, use QUASAR_SCOPED_TIMER() instead of creating a ScopedTimer directly.
Log::Init() must have been called before the scope ends.
|
explicit |
Starts measuring right away.
| name | Name written in the log message, to know which scope was measured. |