|
|
1.1 ! root 1: /* ! 2: * general-purpose event tracing; ! 3: * for debugging only ! 4: * don't leave calls to trace in the system; ! 5: * put them in when debugging things, ! 6: * and remove them when you're through, ! 7: * so you won't waste memory uselessly ! 8: */ ! 9: ! 10: #include "sys/param.h" ! 11: #include "sys/systm.h" ! 12: ! 13: #define NTRACE 512 ! 14: ! 15: struct trace { ! 16: time_t time; ! 17: int i[4]; ! 18: } tracebuf[NTRACE]; ! 19: ! 20: int traceptr = 0; ! 21: ! 22: trace(p0, p1, p2, p3) ! 23: int p0, p1, p2, p3; ! 24: { ! 25: register struct trace *tp; ! 26: register int s; ! 27: ! 28: s = spl7(); ! 29: tp = &tracebuf[traceptr]; ! 30: if (++traceptr >= NTRACE) ! 31: traceptr = 0; ! 32: splx(s); ! 33: tp->time = time; ! 34: tp->i[0] = p0; ! 35: tp->i[1] = p1; ! 36: tp->i[2] = p2; ! 37: tp->i[3] = p3; ! 38: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.