Annotation of 40BSD/libc/gen/mon.c, revision 1.1

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

unix.superglobalmegacorp.com

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