forked from Ralf12358/EveryCulling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEveryCullingProfiler.h
45 lines (31 loc) · 921 Bytes
/
EveryCullingProfiler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include "EveryCullingCore.h"
#include <unordered_map>
#include <string_view>
#include <chrono>
#include <atomic>
namespace culling
{
class EveryCulling;
class EveryCullingProfiler
{
friend class EveryCulling;
public:
struct ProfilingData
{
std::chrono::steady_clock::time_point mStartTime;
std::chrono::steady_clock::time_point mEndTime;
double mElapsedTime;
};
private:
static thread_local bool IsLocalThreadRecordProfilingData;
static std::atomic<bool> IsProfilingDataRecordByOtherThread;
std::unordered_map<std::string_view, ProfilingData> mProfilingDatas;
void SetStartTime(const char* const cullingModuleName);
void SetEndTime(const char* const cullingModuleName);
public:
EveryCullingProfiler();
double GetElapsedTime(const char* const cullingModuleName);
const std::unordered_map<std::string_view, ProfilingData>& GetProfilingDatas() const;
};
}