QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
ScopedTimer.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <quasar/core/Base.h>
9#include <quasar/core/Timer.h>
10
11#include <string>
12
13namespace Quasar
14{
27 {
28 public:
31 explicit ScopedTimer(std::string name);
32
35
36 ScopedTimer(const ScopedTimer&) = delete;
37 ScopedTimer& operator=(const ScopedTimer&) = delete;
38 ScopedTimer(ScopedTimer&&) = delete;
39 ScopedTimer& operator=(ScopedTimer&&) = delete;
40
41 private:
42 std::string m_Name;
43 Timer m_Timer;
44 };
45}
46
56#ifdef QUASAR_DEBUG
57#define QUASAR_SCOPED_TIMER(name) const ::Quasar::ScopedTimer QUASAR_CONCAT(scopedTimer, __LINE__)(name)
58#else
59#define QUASAR_SCOPED_TIMER(name) \
60 do \
61 { \
62 if constexpr (false) \
63 { \
64 static_cast<void>(::Quasar::ScopedTimer(name)); \
65 } \
66 } while (false)
67#endif
Contains the base definitions and utilities for the Quasar engine.
A high-resolution (steady) timer for measuring elapsed time.
~ScopedTimer()
Logs the name and the time elapsed since the creation, in milliseconds.
ScopedTimer(std::string name)
Starts measuring right away.
High-resolution (steady) timer that measures the time elapsed since it was created or last reset.
Definition Timer.h:19
Contains all the engine code.