Major CM5 commit: include syntax changes, some timer changes, removal
[dyninst.git] / rtinst / src / traceio.h
1 /*
2  * traceio.h
3  *
4  * This file is part of the real-time instrumentation.  The TRACE
5  * macro gets called to buffer performance data on the nodes until it
6  * gets sucked out * asynchronously.
7  *
8  * $Log: traceio.h,v $
9  * Revision 1.2  1994/07/11 22:47:54  jcargill
10  * Major CM5 commit: include syntax changes, some timer changes, removal
11  * of old aggregation code, old pause code, added signal-driven sampling
12  * within node processes
13  *
14  */
15
16 #define TRACE_BUF_SIZE   65535
17
18 #define TRACE(dataPtr, dataLen)                         \
19   do {                                                  \
20         TRACELIBmustRetry = 0;                          \
21         TRACELIBcurrPtr = TRACELIBfreePtr;              \
22         TRACELIBfreePtr += dataLen;                     \
23         if (TRACELIBendPtr < TRACELIBfreePtr) {         \
24             must_end_timeslice();                       \
25             continue;     /* go back and try again */   \
26         }                                               \
27         bcopy (dataPtr, TRACELIBcurrPtr, dataLen);      \
28         TRACELIBcurrPtr = TRACELIBfreePtr;              \
29   } while (TRACELIBmustRetry);
30
31
32 extern char *TRACELIBcurrPtr;      /* current pointer in buffer  */
33 extern char *TRACELIBfreePtr;      /* pointer to next free byte in buffer */
34 extern char *TRACELIBendPtr;       /* last byte in trace buffer */
35 extern char *TRACELIBtraceBuffer;  /* beginning of trace buffer */
36 extern int TRACELIBmustRetry;      /* signal variable from consumer -> producer */
37                                    /* or to put it another way, */
38                                    /* Handler -> Trace macro */
39