Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/gprof/hist.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* hist.c  -  Histogram related operations.
    22
    3    Copyright 2000, 2001 Free Software Foundation, Inc.
     3   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
    44
    55   This file is part of GNU Binutils.
     
    2121
    2222
    23 #include <stdio.h>
    2423#include "libiberty.h"
    2524#include "gprof.h"
     25#include "search_list.h"
     26#include "source.h"
     27#include "symtab.h"
    2628#include "corefile.h"
    2729#include "gmon_io.h"
    2830#include "gmon_out.h"
    2931#include "hist.h"
    30 #include "symtab.h"
    3132#include "sym_ids.h"
    3233#include "utils.h"
     
    3536
    3637static void scale_and_align_entries PARAMS ((void));
     38static void print_header PARAMS ((int));
     39static void print_line PARAMS ((Sym *, double));
     40static int cmp_time PARAMS ((const PTR, const PTR));
    3741
    3842/* Declarations of automatically generated functions to output blurbs.  */
     
    7882
    7983void
    80 DEFUN (hist_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
     84hist_read_rec (ifp, filename)
     85     FILE * ifp;
     86     const char *filename;
    8187{
    8288  bfd_vma n_lowpc, n_highpc;
     
    153159
    154160void
    155 DEFUN (hist_write_hist, (ofp, filename), FILE * ofp AND const char *filename)
     161hist_write_hist (ofp, filename)
     162     FILE * ofp;
     163     const char *filename;
    156164{
    157165  UNIT count;
     
    174182  for (i = 0; i < hist_num_bins; ++i)
    175183    {
    176       bfd_put_16 (core_bfd, hist_sample[i], (bfd_byte *) & count[0]);
     184      bfd_put_16 (core_bfd, (bfd_vma) hist_sample[i], (bfd_byte *) &count[0]);
    177185
    178186      if (fwrite (&count[0], sizeof (count), 1, ofp) != 1)
     
    256264
    257265void
    258 DEFUN_VOID (hist_assign_samples)
     266hist_assign_samples ()
    259267{
    260268  bfd_vma bin_low_pc, bin_high_pc;
     
    345353
    346354static void
    347 DEFUN (print_header, (prefix), const char prefix)
     355print_header (prefix)
     356     int prefix;
    348357{
    349358  char unit[64];
     
    384393
    385394static void
    386 DEFUN (print_line, (sym, scale), Sym * sym AND double scale)
     395print_line (sym, scale)
     396     Sym *sym;
     397     double scale;
    387398{
    388399  if (ignore_zeros && sym->ncalls == 0 && sym->hist.time == 0)
     
    421432
    422433static int
    423 DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
     434cmp_time (lp, rp)
     435     const PTR lp;
     436     const PTR rp;
    424437{
    425438  const Sym *left = *(const Sym **) lp;
     
    448461
    449462void
    450 DEFUN_VOID (hist_print)
     463hist_print ()
    451464{
    452465  Sym **time_sorted_syms, *top_dog, *sym;
    453466  unsigned int index;
    454   int log_scale;
     467  unsigned log_scale;
    455468  double top_time, time;
    456469  bfd_vma addr;
     
    517530          top_time /= hz;
    518531
    519           while (SItab[log_scale].scale * top_time < 1000.0
    520                  && ((size_t) log_scale
    521                      < sizeof (SItab) / sizeof (SItab[0]) - 1))
     532          for (log_scale = 0; log_scale < ARRAY_SIZE (SItab); log_scale ++)
    522533            {
    523               ++log_scale;
     534              double scaled_value = SItab[log_scale].scale * top_time;
     535
     536              if (scaled_value >= 1.0 && scaled_value < 1000.0)
     537                break;
    524538            }
    525539        }
Note: See TracChangeset for help on using the changeset viewer.