Annotation of researchv9/jtools/src/pads/host/stats.c, revision 1.1

1.1     ! root        1: #include <pads.pub>
        !             2: SRCFILE("stats.c")
        !             3: 
        !             4: class PadStats : public PadRcv {
        !             5:        Pad     *pad;
        !             6:        void    allocfree();
        !             7:        void    cachestats();
        !             8:        void    sbrk0();
        !             9:        void    sf0();
        !            10:        void    traffic();
        !            11: public:
        !            12:                PadStats();
        !            13: };
        !            14: 
        !            15: void NewPadStats() { new PadStats; }
        !            16: 
        !            17: PadStats::PadStats()
        !            18: {
        !            19:        void abort(), exit(int);
        !            20:        Menu m;
        !            21: 
        !            22:        pad = new Pad( (PadRcv*) this );
        !            23:        pad->banner( "PadStats:" );
        !            24:        pad->name( "stats" );
        !            25:        m.sort( "abort()?",     (Action)&abort          );
        !            26:        m.sort( "allocfree()",  (Action)&PadStats::allocfree    );
        !            27:        m.sort( "cachestats()", (Action)&PadStats::cachestats   );
        !            28:        m.sort( "exit(0)?",     (Action)&exit,      0   );
        !            29:        m.sort( "sbrk(0)",      (Action)&PadStats::sbrk0                );
        !            30:        m.sort( "sf(0)",        (Action)&PadStats::sf0          );
        !            31:        m.sort( "traffic()",    (Action)&PadStats::traffic      );
        !            32:        pad->menu(m);
        !            33: }
        !            34: 
        !            35: void PadStats::cachestats()
        !            36: {
        !            37:        char *CacheStats();
        !            38:        pad->insert(1, SELECTLINE, CacheStats());
        !            39: }
        !            40: 
        !            41: void PadStats::sf0()
        !            42: {
        !            43:        pad->insert(2, SELECTLINE, sf(0));
        !            44: }
        !            45: 
        !            46: void PadStats::sbrk0()
        !            47: {
        !            48:        pad->insert(3, SELECTLINE, "sbrk(0)=%d=0x%X", sbrk(0), sbrk(0));
        !            49: }
        !            50: 
        !            51: void PadStats::traffic()
        !            52: {
        !            53:        extern long BytesToTerm, BytesFromTerm;
        !            54:        long k = time(0);
        !            55:        pad->insert(k, SELECTLINE,
        !            56:                "%0.9s h->t=%d t->h=%d", ctime(&k)+11, BytesToTerm, BytesFromTerm);
        !            57: }
        !            58: 
        !            59: class Allocator {
        !            60: public:
        !            61:        char    *profile(long);
        !            62: 
        !            63: };
        !            64: //extern Allocator NewDel;
        !            65: 
        !            66: void PadStats::allocfree()
        !            67: {
        !            68: //     char *p; int i;
        !            69: //     for( i = 0; p = NewDel.profile(i); ++i )
        !            70: //             if( *p )
        !            71: //                     pad->insert( i+10, SELECTLINE, p );
        !            72: }

unix.superglobalmegacorp.com

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