Adding trace calls
[charm.git] / examples / bigsim / tools / rewritelog / traceBigSim / traceBigSim.C
1 #include "charm++.h"
2 #include "traceBigSim.h"
3
4 CkpvDeclare(FILE*, bgfp);
5 CkpvDeclare(unsigned long, bgTraceCounter);
6
7
8 void initBigSimTrace()
9 {
10   CkpvInitialize(FILE *, bgfp);
11   CkpvInitialize(unsigned long, bgTraceCounter);
12   CkpvAccess(bgTraceCounter) = 0;
13
14 #ifdef CMK_BLUEGENE_CHARM
15   //   for bigsim emulation, write to files, one for each processor
16   char fname[128];
17   sprintf(fname, "param.%d", CkMyPe());
18   CkpvAccess(bgfp) = fopen(fname, "w");
19   if (CkpvAccess(bgfp) == NULL) 
20     CmiAbort("Failed to generated trace param file!");
21 #else
22   //   for Mambo simulation, write to screen for now
23   CkpvAccess(bgfp) = stdout;
24 #endif
25 }
26
27 void finalizeBigSimTrace()
28 {
29 #ifdef CMK_BLUEGENE_CHARM
30   fclose(CkpvAccess(bgfp));
31 #endif  
32 }