aboutsummaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorBrian Dessent <brian@dessent.net>2008-08-05 19:09:06 +0000
committerBrian Dessent <brian@dessent.net>2008-08-05 19:09:06 +0000
commit4094fdc2084d7c9b9bec9f00354c946c739e1d4f (patch)
tree09e7b6b96de61e4ab606b67d58e74534d75c6db7 /gprof
parent7cadeb2c1530f4d4674b13038e7fc451f9b18378 (diff)
downloadgdb-4094fdc2084d7c9b9bec9f00354c946c739e1d4f.zip
gdb-4094fdc2084d7c9b9bec9f00354c946c739e1d4f.tar.gz
gdb-4094fdc2084d7c9b9bec9f00354c946c739e1d4f.tar.bz2
* gmon_io.c (gmon_out_read): When reading old format gmon.out,
set num_histograms and hist_scale.
Diffstat (limited to 'gprof')
-rw-r--r--gprof/ChangeLog5
-rw-r--r--gprof/gmon_io.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 9faca5a..cb8e1fb 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-05 Brian Dessent <brian@dessent.net>
+
+ * gmon_io.c (gmon_out_read): When reading old format gmon.out,
+ set num_histograms and hist_scale.
+
2008-08-04 Alan Modra <amodra@bigpond.net.au>
* Makefile.am (POTFILES.in): Set LC_ALL=C.
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index 4639932..8d1071a 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -493,10 +493,13 @@ gmon_out_read (const char *filename)
if (!histograms)
{
+ num_histograms = 1;
histograms = xmalloc (sizeof (struct histogram));
histograms->lowpc = tmp.low_pc;
histograms->highpc = tmp.high_pc;
histograms->num_bins = hist_num_bins;
+ hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT))
+ / hist_num_bins;
histograms->sample = xmalloc (hist_num_bins * sizeof (int));
memset (histograms->sample, 0,
hist_num_bins * sizeof (int));