* gmon_io.c (gmon_out_read): When reading old format gmon.out,
authorBrian Dessent <brian@dessent.net>
Tue, 5 Aug 2008 19:09:06 +0000 (19:09 +0000)
committerBrian Dessent <brian@dessent.net>
Tue, 5 Aug 2008 19:09:06 +0000 (19:09 +0000)
set num_histograms and hist_scale.

gprof/ChangeLog
gprof/gmon_io.c

index 9faca5a0a7201c2b7bf9c522ebb2adac46ed4176..cb8e1fbd954fddae3154eab98d282200f079561f 100644 (file)
@@ -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.
index 463993229794451609f4ca79fefa3c141883466d..8d1071a7a52f81c082d374c5551f9d881ccae839 100644 (file)
@@ -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));