diff options
author | bde <bde@FreeBSD.org> | 1994-09-05 16:14:54 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-09-05 16:14:54 +0000 |
commit | 63eff9d9b845dca66ab4dc6bde9960b5edfc249a (patch) | |
tree | cda563e13e0df6f2d4199f44712b1a165f696055 /usr.bin/gprof/printgprof.c | |
parent | 889bf31f37aef15112814b058e35c5d89e8ad6db (diff) | |
download | FreeBSD-src-63eff9d9b845dca66ab4dc6bde9960b5edfc249a.zip FreeBSD-src-63eff9d9b845dca66ab4dc6bde9960b5edfc249a.tar.gz |
New flag -u to suppress functions whose name does not begin with an
underscore. Use it to avoid seeing badsw when profiling the kernel.
Print times more accurately (e.g. usec in %8.0f format instead of
msec in %8.2f format for averages) if hz >= 10000. This should have
no effect now since profhz is only 1024.
Diffstat (limited to 'usr.bin/gprof/printgprof.c')
-rw-r--r-- | usr.bin/gprof/printgprof.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c index 5ede772..884c368 100644 --- a/usr.bin/gprof/printgprof.c +++ b/usr.bin/gprof/printgprof.c @@ -110,7 +110,8 @@ flatprofheader() "% " , "cumulative" , "self " , "" , "self " , "total " , "" ); printf( "%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s %-8.8s\n" , "time" , "seconds " , "seconds" , "calls" , - "ms/call" , "ms/call" , "name" ); + hz >= 10000 ? "us/call" : "ms/call" , + hz >= 10000 ? "us/call" : "ms/call" , "name" ); } flatprofline( np ) @@ -121,12 +122,21 @@ flatprofline( np ) return; } actime += np -> time; - printf( "%5.1f %10.2f %8.2f" , - 100 * np -> time / totime , actime / hz , np -> time / hz ); + if (hz >= 10000) + printf( "%5.1f %10.3f %8.3f" , + 100 * np -> time / totime , actime / hz , np -> time / hz ); + else + printf( "%5.1f %10.2f %8.2f" , + 100 * np -> time / totime , actime / hz , np -> time / hz ); if ( np -> ncall != 0 ) { - printf( " %8d %8.2f %8.2f " , np -> ncall , - 1000 * np -> time / hz / np -> ncall , - 1000 * ( np -> time + np -> childtime ) / hz / np -> ncall ); + if (hz >= 10000) + printf( " %8d %8.0f %8.0f " , np -> ncall , + 1e6 * np -> time / hz / np -> ncall , + 1e6 * ( np -> time + np -> childtime ) / hz / np -> ncall ); + else + printf( " %8d %8.2f %8.2f " , np -> ncall , + 1000 * np -> time / hz / np -> ncall , + 1000 * ( np -> time + np -> childtime ) / hz / np -> ncall ); } else { printf( " %8.8s %8.8s %8.8s " , "" , "" , "" ); } |