doc: Add serial to list of ci file reserved words
[charm.git] / src / ck-perf / tracef.C
index 02b1fdabfb56761ade3b7397cb1f427e87b8e121..7da5b96b329ea8d484adbb813f44225eaad920a6 100644 (file)
@@ -5,19 +5,41 @@
 #include<charm++.h>
 #include<charm-api.h>
                                                                                 
-CpvDeclare(int, a);
+CpvStaticDeclare(int, a);
                                                                                 
 static int isInitialized=0;
                                                                                 
-void checkInit(void) {
+static void checkInit(void) {
         if (isInitialized) return;
         isInitialized=1;
         CpvInitialize(int,a);
         CpvAccess(a)=0;
 }
 
+static char * FortrantoCString(char *x,int len){
+       char *newstr = new char[len + 1];
+  _MEMCHECK(newstr);
+  strncpy(newstr, x, len);
+  newstr[len] = 0;
+       return newstr;
+}
+
+
 FDECL {
-void FTN_NAME(FTRACEBEGIN, ftracebegin)()
+
+#define ftracebegin              FTN_NAME(FTRACEBEGIN, ftracebegin)
+#define ftraceend               FTN_NAME(FTRACEEND, ftraceend)
+#define ftraceregisteruserevent  FTN_NAME(FTRACEREGISTERUSEREVENT, ftraceregisteruserevent)
+#define ftraceuserbracketevent   FTN_NAME(FTRACEUSERBRACKETEVENT, ftraceuserbracketevent)
+#define ftraceUserEvent         FTN_NAME(FTRACEUSEREVENT, ftraceuserevent)
+#define ftraceFlushLog          FTN_NAME(FTRACEFLUSHLOG, ftraceflushlog)
+#define ftraceRegisterFunc      FTN_NAME(FTRACEREGISTERFUNC,ftraceregisterfunc) 
+#define ftraceBeginFunc                 FTN_NAME(FTRACEBEGINFUNC,ftracebeginfunc)
+#define ftraceEndFunc           FTN_NAME(FTRACEENDFUNC,ftraceendfunc)
+
+#define fbgprintf               FTN_NAME(FBGPRINTF, fbgprintf)
+
+void ftracebegin()
 {
           checkInit();
           if ( CpvAccess(a) ==0)
@@ -29,7 +51,7 @@ void FTN_NAME(FTRACEBEGIN, ftracebegin)()
                 { CpvAccess(a)++;}
 }
 
-void FTN_NAME(FTRACEEND, ftraceend)()
+void ftraceend()
 {
           checkInit();
           if ( CpvAccess(a) == 1)
@@ -42,7 +64,7 @@ void FTN_NAME(FTRACEEND, ftraceend)()
                                                                                 
 }
 
-void FTN_NAME(FTRACEREGISTERUSEREVENT, ftraceregisteruserevent)(char *x, int *ein, int *eout, int len)
+void ftraceregisteruserevent(char *x, int *ein, int *eout, int len)
 {
   char *newstr = new char[len + 1];
   _MEMCHECK(newstr);
@@ -52,15 +74,46 @@ void FTN_NAME(FTRACEREGISTERUSEREVENT, ftraceregisteruserevent)(char *x, int *ei
   *eout = newe;
 }
 
-void FTN_NAME(FTRACEUSERBRACKETEVENT, ftraceuserbracketevent)(int *e, double *begint, double *endt)
+void ftraceuserbracketevent(int *e, double *begint, double *endt)
 {
   traceUserBracketEvent(*e, *begint, *endt);
 }
 
-void FTN_NAME(FCMIWALLTIMER, fcmiwalltimer)(double *t)
+void ftraceUserEvent(int *e)
+{
+  traceUserEvent(*e);
+}
+
+void ftraceFlushLog()
 {
-  *t = CmiWallTimer();
+  traceFlushLog();
+}
+
+void ftraceRegisterFunc(char *name,int *outIdx,int lenName){
+       char *newstr = FortrantoCString(name,lenName);
+       *outIdx = traceRegisterFunction(newstr);
+       delete [] newstr;
+}
+
+void ftraceBeginFunc(int *idx){
+       traceBeginFuncIndexProj(*idx,(char*)"FORTRAN",0);
+}
+
+void ftraceEndFunc(int *idx){
+       traceEndFuncIndexProj(*idx);
+}
+
+#if CMK_BIGSIM_CHARM
+void fbgprintf(char *str, int len)
+{
+  char *newstr = new char[len + 1];
+  _MEMCHECK(newstr);
+  strncpy(newstr, str, len);
+  newstr[len] = 0;
+  BgPrintf(newstr);
+  delete [] newstr;
 }
+#endif
 
 }  // FDECL