-
Notifications
You must be signed in to change notification settings - Fork 2
/
FETime.h
34 lines (25 loc) · 873 Bytes
/
FETime.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
#pragma once
#include "FEUniqueID.h"
namespace FocalEngine
{
#define FE_CHRONO_TIME_POINT std::chrono::time_point<std::chrono::high_resolution_clock>
enum FE_TIME_RESOLUTION
{
FE_TIME_RESOLUTION_SECONDS = 0,
FE_TIME_RESOLUTION_MILLISECONDS = 1,
FE_TIME_RESOLUTION_MICROSECONS = 2,
FE_TIME_RESOLUTION_NANOSECONDS = 3
};
class FETime
{
std::unordered_map<std::string, FE_CHRONO_TIME_POINT> TimeStamps;
SINGLETON_PRIVATE_PART(FETime)
public:
SINGLETON_PUBLIC_PART(FETime)
void BeginTimeStamp(std::string Label = "");
double EndTimeStamp(std::string Label = "", FE_TIME_RESOLUTION TimeResolution = FE_TIME_RESOLUTION_MILLISECONDS);
uint64_t GetTimeStamp(FE_TIME_RESOLUTION TimeResolution = FE_TIME_RESOLUTION_MILLISECONDS);
std::string NanosecondTimeStampToDate(uint64_t NanosecondsSinceEpoch = 0);
};
#define TIME FETime::getInstance()
}