#ifndef NONAMESPACE #include <iostream> using namespace std; #else #include <iostream.h> #endif #include <string> #include "p4loga.h" #include "extremes.h" #include "funcstats.h" FuncStats::FuncStats( int aifuncname ) { ifuncname = aifuncname; maxfcomputes.Init( MAXIMUMS, 4 ); minfcomputes.Init( MINIMUMS, 0 ); sumcomputes = 0; ncomputes = 0; maxfelapseds.Init( MAXIMUMS, 4 ); minfelapseds.Init( MINIMUMS, 0 ); sumelapseds = 0; nelapseds = 0; } int FuncStats::GetIFuncName() { return ifuncname; } int FuncStats::GetNComputes() { return ncomputes; } int FuncStats::GetNElapseds() { return nelapseds; } void FuncStats::SetIFuncName( int aifuncname ) { ifuncname = aifuncname; } void FuncStats::UpdateCompute( PidFunc *ppidfunc, double compute ) { maxfcomputes.Insert( ppidfunc, compute ); minfcomputes.Insert( ppidfunc, compute ); sumcomputes += compute; ncomputes++; } void FuncStats::BackoutCompute( PidFunc *ppidfunc, double compute ) { maxfcomputes.Remove( ppidfunc, compute ); minfcomputes.Remove( ppidfunc, compute ); sumcomputes -= compute; ncomputes--; } void FuncStats::UpdateElapsed( PidFunc *ppidfunc, double elapsed ) { maxfelapseds.Insert( ppidfunc, elapsed ); minfelapseds.Insert( ppidfunc, elapsed ); sumelapseds += elapsed; nelapseds++; } void FuncStats::Print() { if( ncomputes ) { cout << "Average Compute Phase Elapsed Time of all " << ncomputes; cout << " occurrences: " << sumcomputes / ncomputes << "\n"; } if( nelapseds ) { cout << "Average Total Elapsed Time of all " << nelapseds; cout << " occurrences: " << sumelapseds / nelapseds << "\n"; } maxfcomputes.Print( "Compute Phase Maximums" ); minfcomputes.Print( "Compute Phase Minimums" ); maxfelapseds.Print( "Elapsed Maximums" ); minfelapseds.Print( "Elapsed Minimums" ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 1722 | Michael Shields |
p4loga builds for freebsd4 (play), hpux11 (hell), linux24x86 (duey), and solaris26 (shucks). A bit of porting was required for the hpux11 build (aCC as configured on hell isn't quite up to speed with respect to namespaces). |
||
#1 | 1610 | Michael Shields |
Adding p4d log analyzer concocted by myself. Compiles and executes on Red Hat 6.0, 7.0, and probably a few other operating systems with perhaps a little help. Still needs comments. |