diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-08-12 04:43:32 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-08-12 04:43:32 -0700 |
commit | f3445b37b67deb8f67f7885274b2544684503f78 (patch) | |
tree | 7728c7ad03f97288e55905fe67725498771729c1 /gprof/hist.c | |
parent | 3aade68889268c7d15e121d6d63cb1b753ec12fa (diff) | |
download | gdb-f3445b37b67deb8f67f7885274b2544684503f78.zip gdb-f3445b37b67deb8f67f7885274b2544684503f78.tar.gz gdb-f3445b37b67deb8f67f7885274b2544684503f78.tar.bz2 |
Remove trailing spaces in gprof
Diffstat (limited to 'gprof/hist.c')
-rw-r--r-- | gprof/hist.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/gprof/hist.c b/gprof/hist.c index 058ef3f..404c362 100644 --- a/gprof/hist.c +++ b/gprof/hist.c @@ -80,14 +80,14 @@ SItab[] = /* Reads just the header part of histogram record into *RECORD from IFP. FILENAME is the name of IFP and - is provided for formatting error messages only. + is provided for formatting error messages only. If FIRST is non-zero, sets global variables HZ, HIST_DIMENSION, HIST_DIMENSION_ABBREV, HIST_SCALE. If FIRST is zero, checks that the new histogram is compatible with already-set values of those variables and emits an error if that's not so. */ static void -read_histogram_header (histogram *record, +read_histogram_header (histogram *record, FILE *ifp, const char *filename, int first) { @@ -109,7 +109,7 @@ read_histogram_header (histogram *record, done (1); } - n_hist_scale = (double)((record->highpc - record->lowpc) / sizeof (UNIT)) + n_hist_scale = (double)((record->highpc - record->lowpc) / sizeof (UNIT)) / record->num_bins; if (first) @@ -124,13 +124,13 @@ read_histogram_header (histogram *record, hz = profrate; memcpy (hist_dimension, n_hist_dimension, 15); hist_dimension_abbrev = n_hist_dimension_abbrev; - hist_scale = n_hist_scale; + hist_scale = n_hist_scale; } else { if (strncmp (n_hist_dimension, hist_dimension, 15) != 0) { - fprintf (stderr, + fprintf (stderr, _("%s: dimension unit changed between histogram records\n" "%s: from '%s'\n" "%s: to '%s'\n"), @@ -140,12 +140,12 @@ read_histogram_header (histogram *record, if (n_hist_dimension_abbrev != hist_dimension_abbrev) { - fprintf (stderr, + fprintf (stderr, _("%s: dimension abbreviation changed between histogram records\n" "%s: from '%c'\n" "%s: to '%c'\n"), whoami, whoami, hist_dimension_abbrev, whoami, n_hist_dimension_abbrev); - done (1); + done (1); } /* The only reason we require the same scale for histograms is that @@ -154,10 +154,10 @@ read_histogram_header (histogram *record, things for different functions. */ if (fabs (hist_scale - n_hist_scale) > 0.000001) { - fprintf (stderr, + fprintf (stderr, _("%s: different scales in histogram records"), whoami); - done (1); + done (1); } } } @@ -191,10 +191,10 @@ hist_read_rec (FILE * ifp, const char *filename) hist_clip_symbol_address (&lowpc, &highpc); if (lowpc != highpc) { - fprintf (stderr, + fprintf (stderr, _("%s: overlapping histogram records\n"), whoami); - done (1); + done (1); } /* This is new record. Add it to global array and allocate space for @@ -203,10 +203,10 @@ hist_read_rec (FILE * ifp, const char *filename) xrealloc (histograms, sizeof (histogram) * (num_histograms + 1)); memcpy (histograms + num_histograms, &n_record, sizeof (histogram)); - record = &histograms[num_histograms]; + record = &histograms[num_histograms]; ++num_histograms; - record->sample = (int *) xmalloc (record->num_bins + record->sample = (int *) xmalloc (record->num_bins * sizeof (record->sample[0])); memset (record->sample, 0, record->num_bins * sizeof (record->sample[0])); } @@ -217,9 +217,9 @@ hist_read_rec (FILE * ifp, const char *filename) DBG (SAMPLEDEBUG, printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %u\n", - (unsigned long) record->lowpc, (unsigned long) record->highpc, + (unsigned long) record->lowpc, (unsigned long) record->highpc, record->num_bins)); - + for (i = 0; i < record->num_bins; ++i) { UNIT count; @@ -233,8 +233,8 @@ hist_read_rec (FILE * ifp, const char *filename) record->sample[i] += bfd_get_16 (core_bfd, (bfd_byte *) & count[0]); DBG (SAMPLEDEBUG, printf ("[hist_read_rec] 0x%lx: %u\n", - (unsigned long) (record->lowpc - + i * (record->highpc - record->lowpc) + (unsigned long) (record->lowpc + + i * (record->highpc - record->lowpc) / record->num_bins), record->sample[i])); } @@ -255,7 +255,7 @@ hist_write_hist (FILE * ofp, const char *filename) histogram *record = &histograms[r]; /* Write header. */ - + if (gmon_io_write_8 (ofp, GMON_TAG_TIME_HIST) || gmon_io_write_vma (ofp, record->lowpc) || gmon_io_write_vma (ofp, record->highpc) @@ -267,11 +267,11 @@ hist_write_hist (FILE * ofp, const char *filename) perror (filename); done (1); } - + for (i = 0; i < record->num_bins; ++i) { bfd_put_16 (core_bfd, (bfd_vma) record->sample[i], (bfd_byte *) &count[0]); - + if (fwrite (&count[0], sizeof (count), 1, ofp) != 1) { perror (filename); @@ -453,7 +453,7 @@ hist_assign_samples () for (i = 0; i < num_histograms; ++i) hist_assign_samples_1 (&histograms[i]); - + } /* Print header for flag histogram profile. */ @@ -637,7 +637,7 @@ hist_print () { double scaled_value = SItab[log_scale].scale * top_time; - if (scaled_value >= 1.0 && scaled_value < 1000.0) + if (scaled_value >= 1.0 && scaled_value < 1000.0) break; } } @@ -675,7 +675,7 @@ hist_check_address (unsigned address) if (histograms[i].lowpc <= address && address < histograms[i].highpc) return 1; - return 0; + return 0; } #if ! defined(min) @@ -750,5 +750,5 @@ find_histogram_for_pc (bfd_vma pc) if (histograms[i].lowpc <= pc && pc < histograms[i].highpc) return &histograms[i]; } - return 0; + return 0; } |