Annotation of researchv8dc/cmd/sh/profile.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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