Annotation of researchv9/libc/gen/mon.c, revision 1.1

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

unix.superglobalmegacorp.com

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