1: /* @(#)mon.c 2.1 SCCS id keyword */ 2: monitor(lowpc, highpc, buf, bufsiz, cntsiz) 3: char *lowpc, *highpc; 4: int *buf, bufsiz; 5: { 6: register o; 7: static *sbuf, ssiz; 8: 9: if (lowpc == 0) { 10: profil(0, 0, 0, 0); 11: o = creat("mon.out", 0666); 12: write(o, sbuf, ssiz<<1); 13: close(o); 14: return; 15: } 16: ssiz = bufsiz; 17: buf[0] = (int)lowpc; 18: buf[1] = (int)highpc; 19: buf[2] = cntsiz; 20: sbuf = buf; 21: buf += 3*(cntsiz+1); 22: bufsiz -= 3*(cntsiz+1); 23: if (bufsiz<=0) 24: return; 25: o = ((highpc - lowpc)>>1) & 077777; 26: if(bufsiz < o) 27: o = ((long)bufsiz<<15) / o; 28: else 29: o = 077777; 30: profil(buf, bufsiz<<1, lowpc, o<<1); 31: }