I fixed the bug the the marco TRACE update TRACELIBcurrPtr even though
[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.3  1995/12/05 03:25:32  zhichen
10  * I fixed the bug the the marco TRACE update TRACELIBcurrPtr even though
11  * the buffer is already filled up. (The consequence is a PN bus error)
12  *
13  * Revision 1.2  1994/07/11  22:47:54  jcargill
14  * Major CM5 commit: include syntax changes, some timer changes, removal
15  * of old aggregation code, old pause code, added signal-driven sampling
16  * within node processes
17  *
18  */
19
20 #define TRACE_BUF_SIZE   65535
21
22 #define TRACE(dataPtr, dataLen)                         \
23   do {                                                  \
24         TRACELIBmustRetry = 0;                          \
25         TRACELIBcurrPtr = TRACELIBfreePtr;              \
26         TRACELIBfreePtr += dataLen;                     \
27         if (TRACELIBendPtr < TRACELIBfreePtr) {         \
28             must_end_timeslice();                       \
29             TRACELIBfreePtr -= dataLen;                 \
30             continue;     /* go back and try again */   \
31         }                                               \
32         bcopy (dataPtr, TRACELIBcurrPtr, dataLen);      \
33   } while (TRACELIBmustRetry);
34
35 /********************************************************
36  * IT IS USED TO BE AS FOLLOWS,                         *
37  * I CHANGED IT TO GET RID OF A pn bUS ERROR            *
38  ********************************************************/
39 /*
40 #define TRACE(dataPtr, dataLen)                         \
41   do {                                                  \
42         TRACELIBmustRetry = 0;                          \
43         TRACELIBcurrPtr = TRACELIBfreePtr;              \
44         TRACELIBfreePtr += dataLen;                     \
45         if (TRACELIBendPtr < TRACELIBfreePtr) {         \
46             must_end_timeslice();                       \
47             continue;      * go back and try again *    \
48         }                                               \
49         bcopy (dataPtr, TRACELIBcurrPtr, dataLen);      \
50         TRACELIBcurrPtr = TRACELIBfreePtr;              \
51   } while (TRACELIBmustRetry);
52 */
53
54 extern char *TRACELIBcurrPtr;      /* current pointer in buffer  */
55 extern char *TRACELIBfreePtr;      /* pointer to next free byte in buffer */
56 extern char *TRACELIBendPtr;       /* last byte in trace buffer */
57 extern char *TRACELIBtraceBuffer;  /* beginning of trace buffer */
58 extern int TRACELIBmustRetry;      /* signal variable from consumer -> producer */
59                                    /* or to put it another way, */
60                                    /* Handler -> Trace macro */
61