-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProfileClass.h
68 lines (52 loc) · 1.13 KB
/
ProfileClass.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifdef _WIN32
#ifndef PROFILER_INC
#define PROFILER_INC
// Only compile, if you wish some information about the speed the functions in SpeedSim have
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <tchar.h>
#include <windows.h>
using namespace std;
typedef unsigned long DWORD;
struct CallTime
{
LARGE_INTEGER Timesum;
};
struct Func
{
DWORD Index;
LARGE_INTEGER TimeSum;
LARGE_INTEGER tmpTime;
DWORD NumCalls;
string name;
Func(DWORD i=0, const string& n = "") {
Index = i;
name = n;
TimeSum.QuadPart = 0;
NumCalls = 0;
}
};
class CProfiler
{
public:
static CProfiler& GetInst();
~CProfiler();
void AddFunction(DWORD Index, const string& name);
void BeginFunction(DWORD FuncNr);
void EndFunction(DWORD FuncNr=-1);
void GetResults(ostream& os);
private:
CProfiler();
CProfiler(CProfiler& p);
typedef map<DWORD, Func>::iterator FuncIt;
map<DWORD, Func> m_Functions;
FuncIt m_LastBeganFunction;
DWORD m_LastFuncIndex;
};
#endif
#endif