aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/gprof/printgprof.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2002-02-21 12:07:21 +0000
committerBruce Evans <bde@FreeBSD.org>2002-02-21 12:07:21 +0000
commit8d57b8d3d27c16a9183a6dd2ec266cf876d5bc97 (patch)
tree68ae29f63b9ab11211c7414b3e89eb46039d0f09 /usr.bin/gprof/printgprof.c
parent312a529b81542b2f6c46c753b9f1f38b22ee6fbc (diff)
downloadsrc-8d57b8d3d27c16a9183a6dd2ec266cf876d5bc97.tar.gz
src-8d57b8d3d27c16a9183a6dd2ec266cf876d5bc97.zip
Fixed printf format errors. In printgprof.c, also convert the scale
without possibly losing lots of precision, and print the scale using %g instead of %d in case it is non-integral. %g might not be the best format for this.
Notes
Notes: svn path=/head/; revision=91018
Diffstat (limited to 'usr.bin/gprof/printgprof.c')
-rw-r--r--usr.bin/gprof/printgprof.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c
index 0fb74f44ce98..945ff8d36bea 100644
--- a/usr.bin/gprof/printgprof.c
+++ b/usr.bin/gprof/printgprof.c
@@ -99,8 +99,8 @@ flatprofheader()
if ( bflag ) {
printblurb( _PATH_FLAT_BLURB );
}
- printf( "\ngranularity: each sample hit covers %d byte(s)" ,
- (long) scale * sizeof(UNIT) );
+ printf( "\ngranularity: each sample hit covers %g byte(s)" ,
+ scale * sizeof(UNIT) );
if ( totime > 0.0 ) {
printf( " for %.2f%% of %.2f seconds\n\n" ,
100.0/totime , totime / hz );
@@ -136,15 +136,15 @@ flatprofline( np )
100 * np -> time / totime , actime / hz , np -> time / hz );
if ( np -> ncall != 0 ) {
if (hz >= 10000000)
- printf( " %8d %8.0f %8.0f " , np -> ncall ,
+ printf( " %8ld %8.0f %8.0f " , np -> ncall ,
1e9 * np -> time / hz / np -> ncall ,
1e9 * ( np -> time + np -> childtime ) / hz / np -> ncall );
else if (hz >= 10000)
- printf( " %8d %8.0f %8.0f " , np -> ncall ,
+ printf( " %8ld %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 ,
+ printf( " %8ld %8.2f %8.2f " , np -> ncall ,
1000 * np -> time / hz / np -> ncall ,
1000 * ( np -> time + np -> childtime ) / hz / np -> ncall );
} else {
@@ -160,8 +160,8 @@ gprofheader()
if ( bflag ) {
printblurb( _PATH_CALLG_BLURB );
}
- printf( "\ngranularity: each sample hit covers %d byte(s)" ,
- (long) scale * sizeof(UNIT) );
+ printf( "\ngranularity: each sample hit covers %g byte(s)" ,
+ scale * sizeof(UNIT) );
if ( printtime > 0.0 ) {
printf( " for %.2f%% of %.2f seconds\n\n" ,
100.0/printtime , printtime / hz );
@@ -194,9 +194,9 @@ gprofline( np )
np -> propself / hz ,
np -> propchild / hz );
if ( ( np -> ncall + np -> selfcalls ) != 0 ) {
- printf( " %7d" , np -> npropcall );
+ printf( " %7ld" , np -> npropcall );
if ( np -> selfcalls != 0 ) {
- printf( "+%-7d " , np -> selfcalls );
+ printf( "+%-7ld " , np -> selfcalls );
} else {
printf( " %7.7s " , "" );
}
@@ -314,7 +314,7 @@ printparents( childp )
/*
* selfcall or call among siblings
*/
- printf( "%6.6s %5.5s %7.7s %11.11s %7d %7.7s " ,
+ printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
"" , "" , "" , "" ,
arcp -> arc_count , "" );
printname( parentp );
@@ -323,7 +323,7 @@ printparents( childp )
/*
* regular parent of child
*/
- printf( "%6.6s %5.5s %7.2f %11.2f %7d/%-7d " ,
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
"" , "" ,
arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
arcp -> arc_count , cycleheadp -> npropcall );
@@ -348,7 +348,7 @@ printchildren( parentp )
/*
* self call or call to sibling
*/
- printf( "%6.6s %5.5s %7.7s %11.11s %7d %7.7s " ,
+ printf( "%6.6s %5.5s %7.7s %11.11s %7ld %7.7s " ,
"" , "" , "" , "" , arcp -> arc_count , "" );
printname( childp );
printf( "\n" );
@@ -356,7 +356,7 @@ printchildren( parentp )
/*
* regular child of parent
*/
- printf( "%6.6s %5.5s %7.2f %11.2f %7d/%-7d " ,
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld/%-7ld " ,
"" , "" ,
arcp -> arc_time / hz , arcp -> arc_childtime / hz ,
arcp -> arc_count , childp -> cyclehead -> npropcall );
@@ -482,14 +482,14 @@ printcycle( cyclep )
char kirkbuffer[ BUFSIZ ];
sprintf( kirkbuffer , "[%d]" , cyclep -> index );
- printf( "%-6.6s %5.1f %7.2f %11.2f %7d" ,
+ printf( "%-6.6s %5.1f %7.2f %11.2f %7ld" ,
kirkbuffer ,
100 * ( cyclep -> propself + cyclep -> propchild ) / printtime ,
cyclep -> propself / hz ,
cyclep -> propchild / hz ,
cyclep -> npropcall );
if ( cyclep -> selfcalls != 0 ) {
- printf( "+%-7d" , cyclep -> selfcalls );
+ printf( "+%-7ld" , cyclep -> selfcalls );
} else {
printf( " %7.7s" , "" );
}
@@ -507,11 +507,11 @@ printmembers( cyclep )
sortmembers( cyclep );
for ( memberp = cyclep -> cnext ; memberp ; memberp = memberp -> cnext ) {
- printf( "%6.6s %5.5s %7.2f %11.2f %7d" ,
+ printf( "%6.6s %5.5s %7.2f %11.2f %7ld" ,
"" , "" , memberp -> propself / hz , memberp -> propchild / hz ,
memberp -> npropcall );
if ( memberp -> selfcalls != 0 ) {
- printf( "+%-7d" , memberp -> selfcalls );
+ printf( "+%-7ld" , memberp -> selfcalls );
} else {
printf( " %7.7s" , "" );
}
@@ -605,14 +605,14 @@ arccmp( thisp , thatp )
printname( thisparentp );
printf( " calls " );
printname ( thischildp );
- printf( " %f + %f %d/%d\n" ,
+ printf( " %f + %f %ld/%ld\n" ,
thisp -> arc_time , thisp -> arc_childtime ,
thisp -> arc_count , thischildp -> ncall );
printf( "[arccmp] " );
printname( thatparentp );
printf( " calls " );
printname( thatchildp );
- printf( " %f + %f %d/%d\n" ,
+ printf( " %f + %f %ld/%ld\n" ,
thatp -> arc_time , thatp -> arc_childtime ,
thatp -> arc_count , thatchildp -> ncall );
printf( "\n" );