File: profiling.h

package info (click to toggle)
pike8.0 8.0.1956-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 60,580 kB
  • sloc: ansic: 259,734; xml: 36,320; makefile: 3,748; sh: 1,713; cpp: 1,349; awk: 1,036; lisp: 655; javascript: 468; asm: 242; objc: 240; pascal: 157; sed: 34
file content (26 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (6)
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
#ifdef PROF_REALTIME

private mapping __prof_data = ([]);
private System.Timer __prof_timer = System.Timer();

#define PROF_BEGIN(X) __prof_data[X] = __prof_timer->peek()
#define PROF_END(X)   werror("%s : %3.3f\n", X, __prof_timer->peek()-__prof_data[X])
#define PROF_RESULT()

#elif defined(PROF_OFF)

#define PROF_BEGIN(X)
#define PROF_END(X)
#define PROF_RESULT()

#else

private mapping __prof_data = ([]);
private System.Timer __prof_timer = System.Timer();

#define PROF_BEGIN(X) __prof_data[X]-=__prof_timer->peek()
#define PROF_END(X)   __prof_data[X]+=__prof_timer->peek()
#define PROF_RESULT() foreach(__prof_data; string idx; int val) \
  werror("%15s : %3.3f\n", idx, val);

#endif