2 * This file contains the implementation of runtime dynamic instrumentation
3 * functions for a SUNOS SPARC processor.
6 * Revision 1.3 1993/10/01 18:15:53 hollings
7 * Added filtering and resource discovery.
9 * Revision 1.2 1993/08/26 19:43:58 hollings
12 * Revision 1.1 1993/07/02 21:49:35 hollings
17 #include <sys/signal.h>
20 * Now our include files.
26 /* This marks the end of user code in the text file. */
27 /* This is to prevent system libraries with symbols compiled into them
28 * from adding extranious material to our inst. environment.
34 char DYNINSTdata[SYN_INST_BUF_SIZE];
35 char DYNINSTglobalData[SYN_INST_BUF_SIZE];
36 int DYNINSTnumSampled;
38 void DYNINSTincrementCounter(intCounter *counter)
40 if (counter->trigger && (counter->trigger->value <= 0)) return;
44 void DYNINSTdecrementCounter(intCounter *counter)
46 if (counter->trigger && (counter->trigger->value <= 0)) return;
50 void DYNINSTclearCounter(intCounter *counter)
55 void DYNINSTreportCounter(intCounter *counter)
59 sample.value = counter->value;
60 sample.id = counter->id;
62 DYNINSTgenerateTraceRecord(0, TR_SAMPLE, sizeof(sample), &sample);
65 void DYNINSTsimplePrint()
67 printf("inside dynamic inst function\n");
70 void DYNINSTentryPrint(int arg)
72 printf("enter %d\n", arg);
75 void DYNINSTcallFrom(int arg)
77 printf("call from %d\n", arg);
80 void DYNINSTcallReturn(int arg)
82 printf("return to %d\n", arg);
85 void DYNINSTexitPrint(int arg)
87 printf("exit %d\n", arg);
91 * For testing filter code.
94 void DYNINSTtoyFilter(filterArgs *filt, parameters *params)
96 if (filt->filterData == params->arg1) {
97 filt->toCall(filt->callData, params);
102 * This is a function that should be called when we want to sample the
103 * timers and counters. The code to do the sampling is added as func
104 * entry dynamic instrumentation.
107 void DYNINSTsampleValues()
112 void DYNINSTalarmExpire()
116 /* should use atomic test and set for this */
117 if (inSample) return;
121 DYNINSTsampleValues();