Some instrumentation for projector
[charm.git] / src / conv-perf / traceCoreCommon.C
1
2 #include "traceCore.h"
3 #include "traceCoreCommon.h"
4 #include "charmProjections.h"
5 #include "converse.h"
6
7
8 /* Trace Module Constants (Default Values) */
9 #define TRACE_CORE_BUFFER_SIZE 10
10
11 /* Trace Storage and associated Structure */
12 CpvDeclare(int, _traceCoreOn);
13 CpvDeclare(double, _traceCoreInitTime);
14 CpvDeclare(char*, _traceCoreRoot);
15 CpvDeclare(int, _traceCoreBufferSize);
16 CpvDeclare(TraceCore*, _traceCore);
17
18 /* Trace Timer */
19 #define  TRACE_CORE_TIMER   CmiWallTimer
20 inline double TraceCoreTimer() { return TRACE_CORE_TIMER() - CpvAccess(_traceCoreInitTime); }
21
22 /*****************************************************************/
23 /* Tracing API 
24  * Implementation of functions declared in traceCoreCommon.h 
25  *****************************************************************/
26 /* Initialize TraceCore Module */
27 //TODO decide parameters from command line
28 //TODO - trace-common.C
29 extern "C" void initTraceCore(char** argv)
30 {
31   /*CpvInitialize(int, _traceCoreOn);
32         CpvAccess(_traceCoreOn) = 0;*/
33
34   CpvInitialize(char*, _traceCoreRoot);
35         CpvAccess(_traceCoreRoot) = (char *) malloc(strlen(argv[0])+1);
36         _MEMCHECK(CpvAccess(_traceCoreRoot));
37         strcpy(CpvAccess(_traceCoreRoot), argv[0]);
38
39   CpvInitialize(int, _traceCoreBufferSize);
40         CpvAccess(_traceCoreBufferSize) = TRACE_CORE_BUFFER_SIZE;
41
42   CpvInitialize(double, _traceCoreInitTime);
43         CpvAccess(_traceCoreInitTime) = TRACE_CORE_TIMER();
44
45   CpvInitialize(TraceCore*, _traceCore);
46         CpvAccess(_traceCore) = new TraceCore(argv);
47   initCharmProjections();
48 }
49
50 /* End Core Trace Module */
51 //TODO - trace-common.C
52 extern "C" void closeTraceCore() {}
53
54 /* Resume Core Trace Module */
55 //TODO - trace-common.C
56 extern "C" void resumeTraceCore() {}
57
58 /* Suspend Core Trace Module */
59 //TODO - trace-common.C
60 extern "C" void suspendTraceCore() {}
61
62 /*Install the beginIdle/endIdle condition handlers.*/
63 //TODO - trace-common.C
64 extern "C" void beginTraceCore(void) {}
65
66 /*Cancel the beginIdle/endIdle condition handlers.*/
67 //TODO - trace-common.C
68 extern "C" void endTraceCore(void) {}
69
70 /*****************************************************************/
71 /* Tracing API 
72  * Implementation of functions declared in traceCoreAPI.h 
73  *****************************************************************/
74 extern "C" void RegisterLanguage(int lID, char* ln)
75 { CpvAccess(_traceCore)->RegisterLanguage(lID, ln); }
76
77 extern "C" void RegisterEvent(int lID, int eID)
78 { CpvAccess(_traceCore)->RegisterEvent(lID, eID); }
79
80 extern "C" void LogEvent(int lID, int eID)
81 { CpvAccess(_traceCore)->LogEvent(lID, eID); }
82
83 extern "C" void LogEvent1(int lID, int eID, int iLen, int* iData)
84 { CpvAccess(_traceCore)->LogEvent(lID, eID, iLen, iData); }
85
86 extern "C" void LogEvent2(int lID, int eID, int sLen, char* sData)
87 { CpvAccess(_traceCore)->LogEvent(lID, eID, sLen, sData); }
88
89 extern "C" void LogEvent3(int lID, int eID, int iLen, int* iData, int sLen, char* sData)
90 { CpvAccess(_traceCore)->LogEvent(lID, eID, iLen, iData, sLen, sData); }
91
92
93