Annotation of researchv8dc/libc/gen/mon.c, revision 1.1.1.1

1.1       root        1: /* @(#)mon.c   4.1 (Berkeley) 12/21/80 */
                      2: monitor(lowpc, highpc, buf, bufsiz, cntsiz)
                      3: char *lowpc, *highpc;
                      4: int *buf, bufsiz;
                      5: {
                      6:        register o;
                      7:        static *sbuf, ssiz;
                      8:        struct phdr {
                      9:                int *lpc;
                     10:                int *hpc;
                     11:                int ncnt;
                     12:        };
                     13:        struct cnt {
                     14:                int *pc;
                     15:                long ncall;
                     16:        };
                     17: 
                     18:        if (lowpc == 0) {
                     19:                profil(0, 0, 0, 0);
                     20:                o = creat("mon.out", 0666);
                     21:                write(o, sbuf, ssiz);
                     22:                close(o);
                     23:                return;
                     24:        }
                     25:        sbuf = buf;
                     26:        ssiz = bufsiz;
                     27:        buf[0] = (int)lowpc;
                     28:        buf[1] = (int)highpc;
                     29:        buf[2] = cntsiz;
                     30:        o = sizeof(struct phdr) + cntsiz*sizeof(struct cnt);
                     31:        buf = (int *) (((int)buf) + o);
                     32:        bufsiz -= o;
                     33:        if (bufsiz<=0)
                     34:                return;
                     35:        o = ((highpc - lowpc)>>1);
                     36:        if(bufsiz < o)
                     37:                o = ((float) bufsiz / o) * 32768;
                     38:        else
                     39:                o = 0177777;
                     40:        profil(buf, bufsiz, lowpc, o);
                     41: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.