projector files
authorArun Singla <asingla@uiuc.edu>
Wed, 17 Apr 2002 21:48:50 +0000 (21:48 +0000)
committerArun Singla <asingla@uiuc.edu>
Wed, 17 Apr 2002 21:48:50 +0000 (21:48 +0000)
src/conv-perf/charmEvents.h [new file with mode: 0644]
src/conv-perf/traceCore.C [new file with mode: 0644]
src/conv-perf/traceCoreCommon.C [new file with mode: 0644]
src/conv-perf/traceCoreCommon.h [new file with mode: 0644]

diff --git a/src/conv-perf/charmEvents.h b/src/conv-perf/charmEvents.h
new file mode 100644 (file)
index 0000000..50818db
--- /dev/null
@@ -0,0 +1,75 @@
+
+#ifndef __CHARM_EVENTS_H__
+#define __CHARM_EVENTS_H__
+
+#include "traceCoreCommon.h"
+
+/* Language ID */
+#define _CHARM_LANG_ID         2       // language ID for charm 
+
+/* Event IDs */
+#define  _E_CREATION                   1
+#define  _E_BEGIN_PROCESSING           2
+#define  _E_END_PROCESSING             3
+#define  _E_ENQUEUE                    4
+#define  _E_DEQUEUE                    5
+#define  _E_BEGIN_COMPUTATION          6
+#define  _E_END_COMPUTATION            7
+#define  _E_BEGIN_INTERRUPT            8
+#define  _E_END_INTERRUPT              9
+#define  _E_MSG_RECV_CHARM             10
+#define  _E_USER_EVENT_CHARM   13
+#define  _E_BEGIN_PACK          16
+#define  _E_END_PACK            17
+#define  _E_BEGIN_UNPACK        18
+#define  _E_END_UNPACK          19
+
+/* Trace Macros */
+// TODO Currently there is no EventDataPrototype for the purpose of testing
+#define REGISTER_CHARM \
+       { RegisterLanguage(_CHARM_LANG_ID); \
+         RegisterEvent(_CHARM_LANG_ID, _E_CREATION         ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_BEGIN_PROCESSING ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_END_PROCESSING   ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_ENQUEUE          ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_DEQUEUE          ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_BEGIN_COMPUTATION); \
+         RegisterEvent(_CHARM_LANG_ID, _E_END_COMPUTATION  ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_BEGIN_INTERRUPT  ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_END_INTERRUPT    ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_MSG_RECV_CHARM   ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_BEGIN_PACK       ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_END_PACK         ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_BEGIN_UNPACK     ); \
+         RegisterEvent(_CHARM_LANG_ID, _E_END_UNPACK       ); \
+       }
+#define _LOG_E_CREATION() \
+       { LogEvent(_CHARM_LANG_ID, _E_CREATION); }
+#define _LOG_E_BEGIN_PROCESSING() \
+       { LogEvent(_CHARM_LANG_ID, _E_BEGIN_PROCESSING); }
+#define _LOG_E_END_PROCESSING() \
+       { LogEvent(_CHARM_LANG_ID, _E_END_PROCESSING); }
+#define _LOG_E_ENQUEUE() \
+       { LogEvent(_CHARM_LANG_ID, _E_ENQUEUE); }
+#define _LOG_E_DEQUEUE() \
+       { LogEvent(_CHARM_LANG_ID, _E_DEQUEUE); }
+#define _LOG_E_BEGIN_COMPUTATION() \
+       { LogEvent(_CHARM_LANG_ID, _E_BEGIN_COMPUTATION); }
+#define _LOG_E_END_COMPUTATION() \
+       { LogEvent(_CHARM_LANG_ID, _E_END_COMPUTATION); }
+#define _LOG_E_BEGIN_INTERRUPT() \
+       { LogEvent(_CHARM_LANG_ID, _E_BEGIN_INTERRUPT); }
+#define _LOG_E_END_INTERRUPT() \
+       { LogEvent(_CHARM_LANG_ID, _E_END_INTERRUPT); }
+#define _LOG_E_MSG_RECV_CHARM() \
+       { LogEvent(_CHARM_LANG_ID, _E_MSG_RECV_CHARM); }
+#define _LOG_E_BEGIN_PACK() \
+       { LogEvent(_CHARM_LANG_ID, _E_BEGIN_PACK); }
+#define _LOG_E_END_PACK() \
+       { LogEvent(_CHARM_LANG_ID, _E_END_PACK); }
+#define _LOG_E_BEGIN_UNPACK() \
+       { LogEvent(_CHARM_LANG_ID, _E_BEGIN_UNPACK); }
+#define _LOG_E_END_UNPACK() \
+       { LogEvent(_CHARM_LANG_ID, _E_END_UNPACK); }
+
+#endif
diff --git a/src/conv-perf/traceCore.C b/src/conv-perf/traceCore.C
new file mode 100644 (file)
index 0000000..a213f0c
--- /dev/null
@@ -0,0 +1,25 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "converse.h"
+#include "traceCore.h"
+#include "traceCoreCommon.h"
+
+/* Class TraceCore Definition */
+//TODO: currently these are dummy definitions
+void TraceCore::RegisterLanguage(int lID)
+{
+       CmiPrintf("registering language (%d)\n", lID);
+}      
+
+void TraceCore::RegisterEvent(int lID, int eID)
+{
+       CmiPrintf("registering event (%d, %d)\n", lID, eID);
+}      
+
+void TraceCore::LogEvent(int lID, int eID) 
+{
+       CmiPrintf("logging event (%d, %d)\n", lID, eID);
+}
+
diff --git a/src/conv-perf/traceCoreCommon.C b/src/conv-perf/traceCoreCommon.C
new file mode 100644 (file)
index 0000000..a989a65
--- /dev/null
@@ -0,0 +1,55 @@
+
+#include "converse.h"
+#include "traceCore.h"
+#include "traceCoreCommon.h"
+
+/* Trace Module Constants (Default Values) */
+#define TRACE_CORE_BUFFER_SIZE 10000
+
+/* Trace Storage and associated Structure */
+CpvDeclare(char*, _traceCoreRoot);
+CpvDeclare(int, _traceCoreBufferSize);
+CpvDeclare(TraceCore*, _traceCore);
+
+/* Initialize TraceCore Module */
+//TODO decide parameters from command line
+extern "C" void initTraceCore(char** argv)
+{
+  CpvInitialize(int, _traceCoreOn);
+       CpvAccess(_traceCoreOn) = 0;
+
+  CpvInitialize(char*, _traceCoreRoot);
+       CpvAccess(_traceCoreRoot) = (char *) malloc(strlen(argv[0])+1);
+       _MEMCHECK(CpvAccess(_traceCoreRoot));
+       strcpy(CpvAccess(_traceCoreRoot), argv[0]);
+
+  CpvInitialize(int, _traceCoreBufferSize);
+       CpvAccess(_traceCoreBufferSize) = TRACE_CORE_BUFFER_SIZE;
+
+  CpvInitialize(double, _traceCoreInitTime);
+       CpvAccess(_traceCoreInitTime) = TRACE_CORE_TIMER();
+
+  CpvInitialize(TraceCore*, _traceCore);
+       CpvAccess(_traceCore) = new TraceCore();
+}
+
+/* End Core Trace Module */
+//TODO
+extern "C" void closeTraceCore() {}
+
+/* Resume Core Trace Module */
+//TODO
+extern "C" void resumeTraceCore() {}
+
+/* Tracing API */
+extern "C" void RegisterLanguage(int lID)
+{ CpvAccess(_traceCore)->RegisterLanguage(lID); }
+
+extern "C" void RegisterEvent(int lID, int eID)
+{ CpvAccess(_traceCore)->RegisterEvent(lID, eID); }
+
+extern "C" void LogEvent(int lID, int eID)
+{ CpvAccess(_traceCore)->LogEvent(lID, eID); }
+
+
+
diff --git a/src/conv-perf/traceCoreCommon.h b/src/conv-perf/traceCoreCommon.h
new file mode 100644 (file)
index 0000000..f350fe7
--- /dev/null
@@ -0,0 +1,37 @@
+
+#ifndef __TRACE_CORE_COMMON_H__
+#define __TRACE_CORE_COMMON_H__
+
+#include "converse.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Trace Storage and associated Structure */
+CpvDeclare(int, _traceCoreOn);
+CpvDeclare(double, _traceCoreInitTime);
+
+/* Trace Timer */
+#define  TRACE_CORE_TIMER   CmiWallTimer
+inline double TraceCoreTimer() { return TRACE_CORE_TIMER() - CpvAccess(_traceCoreInitTime); }
+
+/* Initialize Core Trace Module */
+void initTraceCore(char** argv);
+
+/* End Core Trace Module */
+void closeTraceCore();
+
+/* Resume Core Trace Module */
+void resumeTraceCore();
+
+/* Tracing API */
+void RegisterLanguage(int lID);
+void RegisterEvent(int lID, int eID);
+void LogEvent(int lID, int eID);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif