From a051e7ccbe09715407d0dcfc097b6ebe61a81ca6 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 4 Nov 1994 00:08:34 +0000 Subject: [PATCH] * printgprof.c (flatprofheader): Always set totime to 1.0 if not greater than 0.0. Suggested by Harold Assink . --- gprof/ChangeLog | 6 ++++++ gprof/printgprof.c | 18 ++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 79a60419f50..5ee36f53abd 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,9 @@ +Fri Oct 21 18:58:02 1994 Ken Raeburn + + * printgprof.c (flatprofheader): Always set totime to 1.0 if not + greater than 0.0. Suggested by Harold Assink + . + Fri Sep 23 15:06:45 1994 Ken Raeburn * printgprof.c (printprof): Use free, not cfree. diff --git a/gprof/printgprof.c b/gprof/printgprof.c index f4e5167784c..f664bcab0b7 100644 --- a/gprof/printgprof.c +++ b/gprof/printgprof.c @@ -91,21 +91,19 @@ flatprofheader() if (bsd_style_output) { printf( "\ngranularity: each sample hit covers %d byte(s)" , (long) scale * sizeof(UNIT) ); - if ( totime > 0.0 ) { - printf( " for %.2f%% of %.2f seconds\n\n" , - 100.0/totime , totime / hz ); - } else { - printf( " no time accumulated\n\n" ); - /* - * this doesn't hurt since all the numerators will be zero. - */ - totime = 1.0; - } + if (totime > 0.0) + printf(" for %.2f%% of %.2f seconds\n\n", 100.0/totime, totime / hz); } else { printf( "\nEach sample counts as %g seconds.\n", 1.0 / hz); } + if (totime <= 0.0) + { + printf(" no time accumulated\n\n"); + /* This doesn't hurt since all the numerators will be zero. */ + totime = 1.0; + } printf( "%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s %-8.8s\n" , "% " , "cumulative" , "self " , "" , "self " , "total " , "" ); printf( "%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s %-8.8s\n" , -- 2.30.2