1#ifndef AYONCPPAPIINSTRUMENTOR_H
2#define AYONCPPAPIINSTRUMENTOR_H
34 BeginSession(
const std::string &name,
const std::string &filepath =
"results.json") {
35 std::lock_guard<std::mutex> lock(
m_Mutex);
52 std::future<void> async = std::async(std::launch::async, [
this, result]() {
WriteProfile(result); });
58 std::lock_guard<std::mutex> lock(
m_Mutex);
62 std::string name = result.
Name;
63 std::replace(name.begin(), name.end(),
'"',
'\'');
110 auto endTimepoint = std::chrono::high_resolution_clock::now();
113 = std::chrono::time_point_cast<std::chrono::microseconds>(
m_StartTimepoint).time_since_epoch().count();
115 = std::chrono::time_point_cast<std::chrono::microseconds>(endTimepoint).time_since_epoch().count();
117 uint32_t threadID = std::hash<std::thread::id>{}(std::this_thread::get_id());
Definition: Instrumentor.h:97
std::chrono::time_point< std::chrono::high_resolution_clock > m_StartTimepoint
Definition: Instrumentor.h:126
const char * m_Name
Definition: Instrumentor.h:125
~InstrumentationTimer()
Definition: Instrumentor.h:103
bool m_Stopped
Definition: Instrumentor.h:127
void Stop()
Definition: Instrumentor.h:109
InstrumentationTimer(const char *name)
Definition: Instrumentor.h:99
Definition: Instrumentor.h:22
void EndSession()
Definition: Instrumentor.h:42
static Instrumentor & Get()
Definition: Instrumentor.h:91
void WriteProfile(const ProfileResult &result)
Definition: Instrumentor.h:57
std::mutex m_Mutex
Definition: Instrumentor.h:27
std::ofstream m_OutputStream
Definition: Instrumentor.h:25
InstrumentationSession * m_CurrentSession
Definition: Instrumentor.h:24
void WriteFooter()
Definition: Instrumentor.h:85
int m_ProfileCount
Definition: Instrumentor.h:26
void WriteHeader()
Definition: Instrumentor.h:79
Instrumentor()
Definition: Instrumentor.h:30
void WriteProfileAsync(const ProfileResult &result)
Definition: Instrumentor.h:51
void BeginSession(const std::string &name, const std::string &filepath="results.json")
Definition: Instrumentor.h:34
Definition: Instrumentor.h:18
std::string Name
Definition: Instrumentor.h:19
Definition: Instrumentor.h:12
long long End
Definition: Instrumentor.h:14
std::string Name
Definition: Instrumentor.h:13
uint32_t ThreadID
Definition: Instrumentor.h:15
long long Start
Definition: Instrumentor.h:14