Fix copyright comments and file comments.
[deliverable/binutils-gdb.git] / gprof / hist.c
index e027d9a5528e69e6750bae17ff22e9a3a3bcddae..56ef25a0a3ca141f26d80b6ee3ed525225b0ab0d 100644 (file)
@@ -130,11 +130,12 @@ DEFUN (hist_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
 
   DBG (SAMPLEDEBUG,
        printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %d\n",
-              n_lowpc, n_highpc, ncnt);
+              (unsigned long) n_lowpc, (unsigned long) n_highpc, ncnt);
        printf ("[hist_read_rec] s_lowpc 0x%lx s_highpc 0x%lx nsamples %d\n",
-              s_lowpc, s_highpc, hist_num_bins);
+              (unsigned long) s_lowpc, (unsigned long) s_highpc,
+              hist_num_bins);
        printf ("[hist_read_rec]   lowpc 0x%lx   highpc 0x%lx\n",
-              lowpc, highpc));
+              (unsigned long) lowpc, (unsigned long) highpc));
 
   if (n_lowpc != s_lowpc || n_highpc != s_highpc
       || ncnt != hist_num_bins || hz != profrate)
@@ -229,8 +230,9 @@ scale_and_align_entries ()
        {
          DBG (SAMPLEDEBUG,
               printf ("[scale_and_align_entries] pushing 0x%lx to 0x%lx\n",
-                      sym->hist.scaled_addr,
-                      sym->hist.scaled_addr + UNITS_TO_CODE));
+                      (unsigned long) sym->hist.scaled_addr,
+                      (unsigned long) (sym->hist.scaled_addr
+                                       + UNITS_TO_CODE)));
          sym->hist.scaled_addr += UNITS_TO_CODE;
        }
     }
@@ -305,7 +307,8 @@ DEFUN_VOID (hist_assign_samples)
       DBG (SAMPLEDEBUG,
           printf (
       "[assign_samples] bin_low_pc=0x%lx, bin_high_pc=0x%lx, bin_count=%d\n",
-                   sizeof (UNIT) * bin_low_pc, sizeof (UNIT) * bin_high_pc,
+                   (unsigned long) (sizeof (UNIT) * bin_low_pc),
+                   (unsigned long) (sizeof (UNIT) * bin_high_pc),
                    bin_count));
       total_time += time;
 
@@ -338,9 +341,10 @@ DEFUN_VOID (hist_assign_samples)
              DBG (SAMPLEDEBUG,
                   printf (
                            "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n",
-                           symtab.base[j].addr, sizeof (UNIT) * sym_high_pc,
+                           (unsigned long) symtab.base[j].addr,
+                           (unsigned long) (sizeof (UNIT) * sym_high_pc),
                            symtab.base[j].name, overlap * time / hist_scale,
-                           overlap));
+                           (long) overlap));
              addr = symtab.base[j].addr;
              credit = overlap * time / hist_scale;
              /*
@@ -427,9 +431,9 @@ DEFUN (print_line, (sym, scale), Sym * sym AND double scale)
              total_time > 0.0 ? 100 * sym->hist.time / total_time : 0.0,
              accum_time / hz, sym->hist.time / hz);
     }
-  if (sym->ncalls)
+  if (sym->ncalls != 0)
     {
-      printf (" %8d %8.2f %8.2f  ",
+      printf (" %8lu %8.2f %8.2f  ",
              sym->ncalls, scale * sym->hist.time / hz / sym->ncalls,
          scale * (sym->hist.time + sym->cg.child_time) / hz / sym->ncalls);
     }
@@ -460,7 +464,6 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
   const Sym *left = *(const Sym **) lp;
   const Sym *right = *(const Sym **) rp;
   double time_diff;
-  long call_diff;
 
   time_diff = right->hist.time - left->hist.time;
   if (time_diff > 0.0)
@@ -472,12 +475,11 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
       return -1;
     }
 
-  call_diff = right->ncalls - left->ncalls;
-  if (call_diff > 0)
+  if (right->ncalls > left->ncalls)
     {
       return 1;
     }
-  if (call_diff < 0)
+  if (right->ncalls < left->ncalls)
     {
       return -1;
     }
@@ -547,7 +549,7 @@ DEFUN_VOID (hist_print)
       for (index = 0; index < symtab.len; ++index)
        {
          sym = time_sorted_syms[index];
-         if (sym->ncalls)
+         if (sym->ncalls != 0)
            {
              time = (sym->hist.time + sym->cg.child_time) / sym->ncalls;
              if (time > top_time)
@@ -557,7 +559,7 @@ DEFUN_VOID (hist_print)
                }
            }
        }
-      if (top_dog && top_dog->ncalls && top_time > 0.0)
+      if (top_dog && top_dog->ncalls != 0 && top_time > 0.0)
        {
          top_time /= hz;
          while (SItab[log_scale].scale * top_time < 1000.0
This page took 0.025479 seconds and 4 git commands to generate.