checking outstanding changes in my CVS
[IRC.git] / Robust / src / Runtime / coreprof / coreprof.h
1 #ifndef COREPROF_H
2 #define COREPROF_H
3
4 #ifndef CPMAXEVENTS
5 #define CPMAXEVENTS (1024*1024*128)
6 #endif
7
8 #define CP_BEGIN 0
9 #define CP_END 1
10 #define CP_EVENT 2
11 #define CP_MASK 3
12 #define CP_BASE_SHIFT 2
13
14 #define CP_MAIN 0
15
16 struct coreprofmonitor {
17   int index;
18   struct coreprofmonitor * next;
19   unsigned int value[MAXEVENTS];
20 };
21
22 extern __thread int cp_threadnum;
23 extern __thread struct coreprofmonitor * cp_events;
24 extern struct coreprofmonitor * cp_eventlist;
25 void createprofiler();
26 void dumpprofiler();
27
28 #define CPLOGTIME *((long long *)&cp_events->value[cp_events->index])=rdtsc();  \
29   cp_events->index+=2;
30
31 #define CPLOGEVENT(x) { CP_events->value[cp_events->index++]=x; \
32     CPLOGTIME                                                   \
33       }
34 #endif