00001
00002 #include "traceCore.h"
00003 #include "traceCoreAPI.h"
00004 #include "traceCoreCommon.h"
00005 #include "charmProjections.h"
00006 #include "converse.h"
00007
00008
00009
00010 #define TRACE_CORE_BUFFER_SIZE 10
00011
00012
00013 CpvDeclare(int, _traceCoreOn);
00014 CpvDeclare(double, _traceCoreInitTime);
00015 CpvDeclare(char*, _traceCoreRoot);
00016 CpvDeclare(int, _traceCoreBufferSize);
00017 CpvDeclare(TraceCore*, _traceCore);
00018
00019
00020 #define TRACE_CORE_TIMER CmiWallTimer
00021 inline double TraceCoreTimer() { return TRACE_CORE_TIMER() - CpvAccess(_traceCoreInitTime); }
00022
00023
00024
00025
00026
00027
00028
00029
00030 extern "C" void initTraceCore(char** argv)
00031 {
00032
00033
00034
00035 CpvInitialize(char*, _traceCoreRoot);
00036 CpvAccess(_traceCoreRoot) = (char *) malloc(strlen(argv[0])+1);
00037 _MEMCHECK(CpvAccess(_traceCoreRoot));
00038 strcpy(CpvAccess(_traceCoreRoot), argv[0]);
00039
00040 CpvInitialize(int, _traceCoreBufferSize);
00041 CpvAccess(_traceCoreBufferSize) = TRACE_CORE_BUFFER_SIZE;
00042
00043 CpvInitialize(double, _traceCoreInitTime);
00044 CpvAccess(_traceCoreInitTime) = TRACE_CORE_TIMER();
00045
00046 CpvInitialize(TraceCore*, _traceCore);
00047 CpvAccess(_traceCore) = new TraceCore(argv);
00048
00049
00050 }
00051
00052
00053
00054 extern "C" void closeTraceCore() {
00055
00056 delete CpvAccess(_traceCore);
00057 }
00058
00059
00060
00061 extern "C" void resumeTraceCore() {}
00062
00063
00064
00065 extern "C" void suspendTraceCore() {}
00066
00067
00068
00069 extern "C" void beginTraceCore(void) {}
00070
00071
00072
00073 extern "C" void endTraceCore(void) {}
00074
00075
00076
00077
00078
00079 extern "C" void RegisterLanguage(int lID, const char* ln)
00080 { LOGCONDITIONAL(CpvAccess(_traceCore)->RegisterLanguage(lID, ln)); }
00081
00082 extern "C" void RegisterEvent(int lID, int eID)
00083 { LOGCONDITIONAL(CpvAccess(_traceCore)->RegisterEvent(lID, eID)); }
00084
00085
00086
00087 extern "C" void LogEvent(int lID, int eID)
00088 { CpvAccess(_traceCore)->LogEvent(lID, eID); }
00089
00090 extern "C" void LogEvent1(int lID, int eID, int iLen, const int* iData)
00091 { CpvAccess(_traceCore)->LogEvent(lID, eID, iLen, iData); }
00092
00093 extern "C" void LogEvent2(int lID, int eID, int sLen, const char* sData)
00094 { CpvAccess(_traceCore)->LogEvent(lID, eID, sLen, sData); }
00095
00096 extern "C" void LogEvent3(int lID, int eID, int iLen, const int* iData, int sLen, const char* sData)
00097 { CpvAccess(_traceCore)->LogEvent(lID, eID, iLen, iData, sLen, sData); }
00098
00099 extern "C" void LogEvent4(int lID, int eID, int iLen, const int* iData, double t)
00100 { CpvAccess(_traceCore)->LogEvent(lID, eID, iLen, iData,t); }
00101