Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto::InstrumentationTimer Class Reference

#include <Instrumentor.h>

Public Member Functions

 InstrumentationTimer (const char *name)
 
void Stop ()
 
 ~InstrumentationTimer ()
 

Private Attributes

const char * m_Name
 
std::chrono::time_point< std::chrono::high_resolution_clock > m_StartTimepoint
 
bool m_Stopped
 

Constructor & Destructor Documentation

◆ InstrumentationTimer()

Muto::InstrumentationTimer::InstrumentationTimer ( const char *  name)
inline
149 : m_Name(name), m_Stopped(false)
150 {
151 m_StartTimepoint = std::chrono::high_resolution_clock::now();
152 }
const char * m_Name
Definition Instrumentor.h:173
std::chrono::time_point< std::chrono::high_resolution_clock > m_StartTimepoint
Definition Instrumentor.h:174
bool m_Stopped
Definition Instrumentor.h:175
constexpr Scope< T > CreateScope(Args &&... args)
Creates a Scope (unique_ptr) for the given type and constructor arguments.
Definition Defines_Macros.h:51

References m_Name, and m_Stopped.

◆ ~InstrumentationTimer()

Muto::InstrumentationTimer::~InstrumentationTimer ( )
inline
155 {
156 if (!m_Stopped)
157 Stop();
158 }
void Stop()
Definition Instrumentor.h:160

References m_Stopped, and Stop().

Member Function Documentation

◆ Stop()

void Muto::InstrumentationTimer::Stop ( )
inline
161 {
162 auto endTimepoint = std::chrono::high_resolution_clock::now();
163
164 long long start = std::chrono::time_point_cast<std::chrono::microseconds>(m_StartTimepoint).time_since_epoch().count();
165 long long end = std::chrono::time_point_cast<std::chrono::microseconds>(endTimepoint).time_since_epoch().count();
166
167 uint32_t threadID = std::hash<std::thread::id>{}(std::this_thread::get_id());
169
170 m_Stopped = true;
171 }
static Instrumentor & Get()
Definition Instrumentor.h:138
void WriteProfile(const ProfileResult &result)
Definition Instrumentor.h:90

References Muto::Instrumentor::Get(), m_Name, m_Stopped, and Muto::Instrumentor::WriteProfile().

Referenced by ~InstrumentationTimer().

Member Data Documentation

◆ m_Name

const char* Muto::InstrumentationTimer::m_Name
private

Referenced by InstrumentationTimer(), and Stop().

◆ m_StartTimepoint

std::chrono::time_point<std::chrono::high_resolution_clock> Muto::InstrumentationTimer::m_StartTimepoint
private

◆ m_Stopped

bool Muto::InstrumentationTimer::m_Stopped
private

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