da0816845d23b06624403e3c0e34a59b41008029
[charm.git] / src / conv-core / conv-trace.h
1 #ifndef _CONV_TRACE_H
2 #define _CONV_TRACE_H
3
4 #include "converse.h"
5
6 /* 
7  * These functions are called from Converse, and should be provided C binding
8  * by the tracing strategies.
9  */
10
11 void traceInit(char **argv);
12 void traceCharmInit(char **argv);       /* init trace module in ck */
13 void traceMessageRecv(char *msg, int pe);
14 void traceBeginIdle(void);
15 void traceEndIdle(void);
16 void traceResume(CmiObjId *);
17 void traceSuspend(void);
18 void traceAwaken(CthThread t);
19 void traceUserEvent(int);
20 void traceUserBracketEvent(int, double, double);
21 void traceUserSuppliedData(int);
22 void traceUserSuppliedBracketedNote(char *note, int eventID, double bt, double et);
23 void traceUserSuppliedNote(char*);
24 void traceMemoryUsage();
25 int  traceRegisterUserEvent(const char*, int e
26 #ifdef __cplusplus
27 =-1
28 #endif
29 );
30
31 #if CMK_SMP_TRACE_COMMTHREAD
32 int  traceBeginCommOp(char *msg);
33 void traceEndCommOp(char *msg);
34 void traceSendMsgComm(char *msg);
35 #endif
36 void traceChangeLastTimestamp(double ts);
37
38 /* Support for machine layers to register their user events to projections */
39 void registerMachineUserEventsFunction(void (*eventRegistrationFunc)());
40
41 int traceRegisterFunction(const char*, int idx
42 #ifdef __cplusplus
43 =-999
44 #endif
45 );
46 void traceBeginFuncIndexProj(int, char* file, int);
47 void traceEndFuncIndexProj(int);
48
49 void traceClose(void);
50 void traceCharmClose(void);          /* close trace in ck */
51 void traceBegin(void);
52 void traceEnd(void);
53 void traceWriteSts(void);
54 void traceFlushLog(void);
55
56 #if CMK_TRACE_ENABLED
57 CpvExtern(int, traceOn);
58 #define traceIsOn()  (CpvAccess(traceOn))
59 #else 
60 #define traceIsOn()  0
61 #endif
62
63 int  traceAvailable();
64
65 /* Comm thread tracing */
66 #if CMK_SMP_TRACE_COMMTHREAD
67 #define  TRACE_COMM_CREATION(time, msg)   \
68                     if (traceBeginCommOp(msg)) {   \
69                       traceChangeLastTimestamp(time);    \
70                       traceSendMsgComm(msg);   \
71                       traceEndCommOp(msg);    \
72                     }
73 #define  TRACE_COMM_RECV(time, msg)   \
74                     if (traceBeginCommOp(msg)) {   \
75                       traceChangeLastTimestamp(time);    \
76                       traceEndCommOp(msg);    \
77                     }
78 #else
79 #define TRACE_COMM_CREATION(time, msg)
80 #define TRACE_COMM_RECV(time, msg)
81 #endif
82
83 #endif