2009-10-08 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / gprof / hist.c
index aa3f7efd43dbf723706e95a8a042f5e11eb76c20..6f4ead83a63ed57cf408fbe23314fb1848791d2f 100644 (file)
@@ -1,6 +1,6 @@
 /* hist.c  -  Histogram related operations.
 
-   Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007
+   Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2009
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -20,8 +20,8 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
    02110-1301, USA.  */
 \f
-#include "libiberty.h"
 #include "gprof.h"
+#include "libiberty.h"
 #include "search_list.h"
 #include "source.h"
 #include "symtab.h"
@@ -48,6 +48,8 @@ extern void flat_blurb (FILE * fp);
 static histogram *find_histogram (bfd_vma lowpc, bfd_vma highpc);
 static histogram *find_histogram_for_pc (bfd_vma pc);
 
+histogram * histograms;
+unsigned num_histograms;
 double hist_scale;
 static char hist_dimension[16] = "seconds";
 static char hist_dimension_abbrev = 's';
@@ -198,8 +200,8 @@ hist_read_rec (FILE * ifp, const char *filename)
 
       /* This is new record.  Add it to global array and allocate space for
         the samples.  */
-      histograms = xrealloc (histograms,
-                            sizeof (histogram) * (num_histograms + 1));
+      histograms = (struct histogram *)
+          xrealloc (histograms, sizeof (histogram) * (num_histograms + 1));
       memcpy (histograms + num_histograms,
              &n_record, sizeof (histogram));
       record = &histograms[num_histograms];      
@@ -464,7 +466,7 @@ print_header (int prefix)
   if (bsd_style_output)
     {
       printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-             (long) hist_scale * sizeof (UNIT));
+             (long) hist_scale * (long) sizeof (UNIT));
       if (total_time > 0.0)
        {
          printf (_(" for %.2f%% of %.2f %s\n\n"),
This page took 0.024176 seconds and 4 git commands to generate.