|
|
1.1 ! root 1: /* ! 2: * libc/crt/_prof.c ! 3: * Runtime profiling. ! 4: */ ! 5: ! 6: #include <stdio.h> ! 7: #include <unistd.h> ! 8: #include <sys/types.h> ! 9: ! 10: #if _I386 ! 11: extern _start(); ! 12: extern __end_text(); ! 13: #define BTEXT _start ! 14: #define ETEXT __end_text ! 15: #else ! 16: extern etext(); ! 17: #define BTEXT (caddr_t)1 ! 18: #define ETEXT etext ! 19: #endif ! 20: ! 21: /* ! 22: * The profiling runtime start-off mcrts0.s ! 23: * enables profiling by calling _profon() before calling main(). ! 24: */ ! 25: _profon() ! 26: { ! 27: #ifndef Z8001 ! 28: register unsigned bufl; ! 29: register short *buf; ! 30: static char emsg[] = "No room for profil buffer\n"; ! 31: ! 32: bufl = ((unsigned)ETEXT - (unsigned)BTEXT) / 2; ! 33: buf = (short *)sbrk(bufl * sizeof (short)); ! 34: if (buf == NULL) { ! 35: write(STDERR_FILENO, emsg, sizeof emsg); ! 36: abort(); ! 37: } ! 38: monitor((caddr_t)BTEXT, (caddr_t)ETEXT, buf, bufl); ! 39: #else ! 40: monitor((caddr_t)1); /* dummy call to start things off */ ! 41: #endif ! 42: } ! 43: ! 44: /* ! 45: * The profiling runtime start-off mcrts0.s ! 46: * disables profiling by calling _profoff() at _exit. ! 47: * It turns off profiling and writes out the final profiling information. ! 48: */ ! 49: _profoff() ! 50: { ! 51: monitor(NULL); ! 52: } ! 53: ! 54: /* end of libc/crt/_prof.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.