|
|
1.1 ! root 1: #include "univ.h" ! 2: #include "audit.h" ! 3: SRCFILE("audit.c") ! 4: ! 5: void Audit::mon(long on) ! 6: { ! 7: extern monitor(long,long=0,short* =0,int=0,int=0); ! 8: if( on ) ! 9: monitor(2, 150000, new short[50000], 50000, 0); ! 10: else ! 11: monitor(0); ! 12: } ! 13: ! 14: void StartAudit() { new Audit; NewPadStats(); } ! 15: ! 16: void Audit::setperiod(long p) { if( period = p ) cycle(); } ! 17: ! 18: void Audit::clone() { new Audit; } ! 19: ! 20: Audit::Audit(){ ! 21: pad = 0; ! 22: lastclock = 0; ! 23: setperiod(0); ! 24: cycle(); ! 25: } ! 26: ! 27: void Audit::lookup() ! 28: { ! 29: extern long IdToSymCalls, StrCmpCalls, LoctosymHit, Loctosym; ! 30: int i = IdToSymCalls, s = StrCmpCalls, h = LoctosymHit, l = Loctosym; ! 31: pad->error("strcmp/idtosym=%d/%d; hit/loctosym=%d/%d", s, i, h, l); ! 32: } ! 33: ! 34: void Audit::lazy() ! 35: { ! 36: extern int FunctionStubs, FunctionGathered, UTypeStubs, UTypeGathered; ! 37: int fs=FunctionStubs, fg=FunctionGathered, us=UTypeStubs, ug=UTypeGathered; ! 38: pad->error( "functions: %d/%d; types: %d/%d", fg, fs, ug, us ); ! 39: } ! 40: ! 41: void Audit::cycle() ! 42: { ! 43: char *ctime(long*); ! 44: long clock, time(long*); ! 45: Menu m; ! 46: void abort(), exit(); ! 47: ! 48: trace( "%d.cycle()", this ); ! 49: if( !pad ){ ! 50: pad = new Pad( (PadRcv*) this ); ! 51: pad->banner( "Audit %d:", this ); ! 52: pad->name( "Audit" ); ! 53: m.sort( "abort()?", (Action)&abort ); ! 54: m.sort( "clone", (Action)&Audit::clone ); ! 55: m.sort( "exit(0)?", (Action)&exit, 0 ); ! 56: m.sort( "lazy symbol", (Action)&Audit::lazy, ); ! 57: m.sort( "lookup", (Action)&Audit::lookup ); ! 58: m.sort( "setperiod(0)", (Action)&Audit::setperiod, 0 ); ! 59: m.sort( "setperiod(1)", (Action)&Audit::setperiod, 1 ); ! 60: m.sort( "setperiod(5)", (Action)&Audit::setperiod, 5 ); ! 61: m.sort( "setperiod(60)",(Action)&Audit::setperiod, 60 ); ! 62: m.sort( "monitor(...)", (Action)&Audit::mon, 1 ); ! 63: m.sort( "monitor(0)", (Action)&Audit::mon, 0 ); ! 64: pad->menu(m); ! 65: } ! 66: if( period ) pad->alarm(period); ! 67: clock = time(0); ! 68: if( clock < lastclock+period ) return; ! 69: lastclock = clock; ! 70: pad->insert( 1, "%24s", ctime( &clock) ); ! 71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.