1#ifndef AYONCPPAPIINSTRUMENTOR_H
2#define AYONCPPAPIINSTRUMENTOR_H
35 BeginSession(
const std::string &name,
const std::string &filepath =
"results.json") {
36 std::lock_guard<std::mutex> lock(
m_Mutex);
53 std::future<void> async = std::async(std::launch::async, [
this, result]() {
WriteProfile(result); });
59 std::lock_guard<std::mutex> lock(
m_Mutex);
63 std::string name = result.
Name;
64 std::replace(name.begin(), name.end(),
'"',
'\'');
111 auto endTimepoint = std::chrono::high_resolution_clock::now();
114 = std::chrono::time_point_cast<std::chrono::microseconds>(
m_StartTimepoint).time_since_epoch().count();
116 = std::chrono::time_point_cast<std::chrono::microseconds>(endTimepoint).time_since_epoch().count();
118 uint32_t threadID = std::hash<std::thread::id>{}(std::this_thread::get_id());
Definition: Instrumentor.h:98
std::chrono::time_point< std::chrono::high_resolution_clock > m_StartTimepoint
Definition: Instrumentor.h:127
const char * m_Name
Definition: Instrumentor.h:126
~InstrumentationTimer()
Definition: Instrumentor.h:104
bool m_Stopped
Definition: Instrumentor.h:128
void Stop()
Definition: Instrumentor.h:110
InstrumentationTimer(const char *name)
Definition: Instrumentor.h:100
Definition: Instrumentor.h:23
void EndSession()
Definition: Instrumentor.h:43
static Instrumentor & Get()
Definition: Instrumentor.h:92
void WriteProfile(const ProfileResult &result)
Definition: Instrumentor.h:58
std::mutex m_Mutex
Definition: Instrumentor.h:28
std::ofstream m_OutputStream
Definition: Instrumentor.h:26
InstrumentationSession * m_CurrentSession
Definition: Instrumentor.h:25
void WriteFooter()
Definition: Instrumentor.h:86
int m_ProfileCount
Definition: Instrumentor.h:27
void WriteHeader()
Definition: Instrumentor.h:80
Instrumentor()
Definition: Instrumentor.h:31
void WriteProfileAsync(const ProfileResult &result)
Definition: Instrumentor.h:52
void BeginSession(const std::string &name, const std::string &filepath="results.json")
Definition: Instrumentor.h:35
Definition: Instrumentor.h:19
std::string Name
Definition: Instrumentor.h:20
Definition: Instrumentor.h:13
long long End
Definition: Instrumentor.h:15
std::string Name
Definition: Instrumentor.h:14
uint32_t ThreadID
Definition: Instrumentor.h:16
long long Start
Definition: Instrumentor.h:15