-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtrace.h
41 lines (33 loc) · 1.05 KB
/
trace.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
#ifndef TRACE_H
#define TRACE_H
#include "options.h"
class TimeTraceImpl;
class TimeTrace
{
public:
TimeTrace(const char* func) : impl(0)
{
if (timetrace)
{
createImpl(func);
}
}
~TimeTrace()
{
if (impl)
destroyImpl();
}
private:
void createImpl(const char* func);
void destroyImpl();
TimeTraceImpl* impl;
};
void trace(const char* file, int line, const char* func);
#define TRACE() \
do \
{ \
if (verbosity) \
trace(__FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (0)
#define TIME_TRACE() TimeTrace timeTraceInstance(__FUNCTION__);
#endif