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