aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2002-02-19 18:29:08 +0000
committerFrank Ch. Eigler <fche@redhat.com>2002-02-19 18:29:08 +0000
commitbe5523fb1fae4992e620666ac9e858604782ccf2 (patch)
tree2213f30bb9d7b43e6f0d1c37087ff33d555eacdb
parentbefc3abbedec2335e0c1f8d43df9119d438f0d35 (diff)
downloadgdb-be5523fb1fae4992e620666ac9e858604782ccf2.zip
gdb-be5523fb1fae4992e620666ac9e858604782ccf2.tar.gz
gdb-be5523fb1fae4992e620666ac9e858604782ccf2.tar.bz2
2002-02-19 Frank Ch. Eigler <fche@redhat.com>
* hist.c (hist_print): Rewrite log_scale calculation loop.
-rw-r--r--gprof/ChangeLog4
-rw-r--r--gprof/hist.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 6b855b6..a5acbee 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,7 @@
+2002-02-19 Frank Ch. Eigler <fche@redhat.com>
+
+ * hist.c (hist_print): Rewrite log_scale calculation loop.
+
2002-02-11 Alan Modra <amodra@bigpond.net.au>
* Makefile.am: "make dep-am".
diff --git a/gprof/hist.c b/gprof/hist.c
index d987656..08aae2e 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -463,7 +463,7 @@ hist_print ()
{
Sym **time_sorted_syms, *top_dog, *sym;
unsigned int index;
- int log_scale;
+ unsigned log_scale;
double top_time, time;
bfd_vma addr;
@@ -528,11 +528,12 @@ hist_print ()
{
top_time /= hz;
- while (SItab[log_scale].scale * top_time < 1000.0
- && ((size_t) log_scale
- < sizeof (SItab) / sizeof (SItab[0]) - 1))
+ for (log_scale = 0; log_scale < ARRAY_SIZE (SItab); log_scale ++)
{
- ++log_scale;
+ double scaled_value = SItab[log_scale].scale * top_time;
+
+ if (scaled_value >= 1.0 && scaled_value < 1000.0)
+ break;
}
}
}