Remove trailing spaces in gprof

This commit is contained in:
H.J. Lu 2015-08-12 04:43:32 -07:00
parent 3aade68889
commit f3445b37b6
13 changed files with 81 additions and 81 deletions

View File

@ -177,7 +177,7 @@
2009-02-12 Ken Werner <ken.werner@de.ibm.com> 2009-02-12 Ken Werner <ken.werner@de.ibm.com>
* corefile.c (core_create_function_syms): Remove "<locore>" and * corefile.c (core_create_function_syms): Remove "<locore>" and
"<hicore>" sentinels. "<hicore>" sentinels.
* gprof.c: Likewise. * gprof.c: Likewise.
* cg_print.c (cg_print_function_ordering): Likewise. * cg_print.c (cg_print_function_ordering): Likewise.

View File

@ -6,12 +6,12 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or # the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see # along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.

View File

@ -22,12 +22,12 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or # the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see # along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.

View File

@ -1,7 +1,7 @@
README for GPROF README for GPROF
This is the GNU profiler. It is distributed with other "binary This is the GNU profiler. It is distributed with other "binary
utilities" which should be in ../binutils. See ../binutils/README for utilities" which should be in ../binutils. See ../binutils/README for
more general notes, including where to send bug reports. more general notes, including where to send bug reports.
This file documents the changes and new features available with this This file documents the changes and new features available with this
@ -118,7 +118,7 @@ Here are some examples:
dots. In such cases, it is necessary to dots. In such cases, it is necessary to
add a leading colon to the name. For example, add a leading colon to the name. For example,
":.mul" selects function ".mul". ":.mul" selects function ".mul".
main.c:main Selects function "main" in file "main.c". main.c:main Selects function "main" in file "main.c".
main.c:134 Selects line 134 in file "main.c". main.c:134 Selects line 134 in file "main.c".
@ -195,7 +195,7 @@ Short Form: Long Form:
option is specified multiple times, the flat option is specified multiple times, the flat
profile includes symbols selected by the union profile includes symbols selected by the union
of all symspecs. of all symspecs.
-P[symspec] --no-flat-profile[=symspec] -P[symspec] --no-flat-profile[=symspec]
Suppress output in the flat profile. If given Suppress output in the flat profile. If given
without an argument, the flat profile is suppressed without an argument, the flat profile is suppressed

View File

@ -282,7 +282,7 @@ print_exec_counts ()
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
{ {
sym = sorted_bbs [i]; sym = sorted_bbs [i];
if (sym->ncalls > 0 || ! ignore_zeros) if (sym->ncalls > 0 || ! ignore_zeros)
{ {
/* FIXME: This only works if bfd_vma is unsigned long. */ /* FIXME: This only works if bfd_vma is unsigned long. */

View File

@ -6,12 +6,12 @@ dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version. dnl (at your option) any later version.
dnl dnl
dnl This program is distributed in the hope that it will be useful, dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details. dnl GNU General Public License for more details.
dnl dnl
dnl You should have received a copy of the GNU General Public License dnl You should have received a copy of the GNU General Public License
dnl along with this program; see the file COPYING3. If not see dnl along with this program; see the file COPYING3. If not see
dnl <http://www.gnu.org/licenses/>. dnl <http://www.gnu.org/licenses/>.

View File

@ -11,13 +11,13 @@ seconds function alone. This is the major sort for this
calls the number of times this function was invoked, if calls the number of times this function was invoked, if
this function is profiled, else blank. this function is profiled, else blank.
self the average number of milliseconds spent in this self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled, ms/call function per call, if this function is profiled,
else blank. else blank.
total the average number of milliseconds spent in this total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this ms/call function and its descendents per call, if this
function is profiled, else blank. function is profiled, else blank.
name the name of the function. This is the minor sort name the name of the function. This is the minor sort

View File

@ -53,11 +53,11 @@
#define GMONVERSION 0x00051879 #define GMONVERSION 0x00051879
/* Size of the old BSD gmon header */ /* Size of the old BSD gmon header */
#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4) #define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4)
/* FIXME: Checking host compiler defines here means that we can't /* FIXME: Checking host compiler defines here means that we can't
use a cross gprof alpha OSF. */ use a cross gprof alpha OSF. */
#if defined(__alpha__) && defined (__osf__) #if defined(__alpha__) && defined (__osf__)
#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4) #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4)
#else #else
#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4) #define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4)

View File

@ -499,7 +499,7 @@ gmon_out_read (const char *filename)
hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT)) hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT))
/ hist_num_bins; / hist_num_bins;
histograms->sample = (int *) xmalloc (hist_num_bins * sizeof (int)); histograms->sample = (int *) xmalloc (hist_num_bins * sizeof (int));
memset (histograms->sample, 0, memset (histograms->sample, 0,
hist_num_bins * sizeof (int)); hist_num_bins * sizeof (int));
} }
@ -532,7 +532,7 @@ gmon_out_read (const char *filename)
done (1); done (1);
} }
histograms->sample[i] histograms->sample[i]
+= bfd_get_16 (core_bfd, (bfd_byte *) raw_bin_count); += bfd_get_16 (core_bfd, (bfd_byte *) raw_bin_count);
} }
@ -671,7 +671,7 @@ gmon_out_write (const char *filename)
case ptr_64bit: case ptr_64bit:
hdrsize = GMON_HDRSIZE_OLDBSD_64; hdrsize = GMON_HDRSIZE_OLDBSD_64;
/* FIXME: Checking host compiler defines here means that we can't /* FIXME: Checking host compiler defines here means that we can't
use a cross gprof alpha OSF. */ use a cross gprof alpha OSF. */
#if defined(__alpha__) && defined (__osf__) #if defined(__alpha__) && defined (__osf__)
padsize = 4; padsize = 4;
#endif #endif
@ -683,7 +683,7 @@ gmon_out_write (const char *filename)
old BSD and 4.4BSD formats. */ old BSD and 4.4BSD formats. */
if (gmon_io_write_vma (ofp, histograms->lowpc) if (gmon_io_write_vma (ofp, histograms->lowpc)
|| gmon_io_write_vma (ofp, histograms->highpc) || gmon_io_write_vma (ofp, histograms->highpc)
|| gmon_io_write_32 (ofp, histograms->num_bins || gmon_io_write_32 (ofp, histograms->num_bins
* sizeof (UNIT) + hdrsize)) * sizeof (UNIT) + hdrsize))
{ {
perror (filename); perror (filename);

View File

@ -612,7 +612,7 @@ This program is free software. This program has absolutely no warranty.\n"));
if (output_style & STYLE_FLAT_PROFILE) if (output_style & STYLE_FLAT_PROFILE)
{ {
/* Print the flat profile. */ /* Print the flat profile. */
hist_print (); hist_print ();
} }
if (cg && (output_style & STYLE_CALL_GRAPH)) if (cg && (output_style & STYLE_CALL_GRAPH))
@ -620,20 +620,20 @@ This program is free software. This program has absolutely no warranty.\n"));
if (!bsd_style_output) if (!bsd_style_output)
{ {
/* Print the dynamic profile. */ /* Print the dynamic profile. */
cg_print (cg); cg_print (cg);
} }
cg_print_index (); cg_print_index ();
} }
if (output_style & STYLE_EXEC_COUNTS) if (output_style & STYLE_EXEC_COUNTS)
print_exec_counts (); print_exec_counts ();
if (output_style & STYLE_ANNOTATED_SOURCE) if (output_style & STYLE_ANNOTATED_SOURCE)
print_annotated_source (); print_annotated_source ();
if (output_style & STYLE_FUNCTION_ORDER) if (output_style & STYLE_FUNCTION_ORDER)
cg_print_function_ordering (); cg_print_function_ordering ();
if (output_style & STYLE_FILE_ORDER) if (output_style & STYLE_FILE_ORDER)
cg_print_file_ordering (); cg_print_file_ordering ();

View File

@ -38,7 +38,7 @@ section entitled ``GNU Free Documentation License''.
@titlepage @titlepage
@title GNU gprof @title GNU gprof
@subtitle The @sc{gnu} Profiler @subtitle The @sc{gnu} Profiler
@ifset VERSION_PACKAGE @ifset VERSION_PACKAGE
@subtitle @value{VERSION_PACKAGE} @subtitle @value{VERSION_PACKAGE}
@end ifset @end ifset
@ -110,14 +110,14 @@ in the section entitled ``GNU Free Documentation License''.
@smallexample @smallexample
@c man begin SYNOPSIS @c man begin SYNOPSIS
gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ] gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ]
[ -I @var{dirs} ] [ -d[@var{num}] ] [ -k @var{from/to} ] [ -I @var{dirs} ] [ -d[@var{num}] ] [ -k @var{from/to} ]
[ -m @var{min-count} ] [ -R @var{map_file} ] [ -t @var{table-length} ] [ -m @var{min-count} ] [ -R @var{map_file} ] [ -t @var{table-length} ]
[ --[no-]annotated-source[=@var{name}] ] [ --[no-]annotated-source[=@var{name}] ]
[ --[no-]exec-counts[=@var{name}] ] [ --[no-]exec-counts[=@var{name}] ]
[ --[no-]flat-profile[=@var{name}] ] [ --[no-]graph[=@var{name}] ] [ --[no-]flat-profile[=@var{name}] ] [ --[no-]graph[=@var{name}] ]
[ --[no-]time=@var{name}] [ --all-lines ] [ --brief ] [ --[no-]time=@var{name}] [ --all-lines ] [ --brief ]
[ --debug[=@var{level}] ] [ --function-ordering ] [ --debug[=@var{level}] ] [ --function-ordering ]
[ --file-ordering @var{map_file} ] [ --directory-path=@var{dirs} ] [ --file-ordering @var{map_file} ] [ --directory-path=@var{dirs} ]
[ --display-unused-functions ] [ --file-format=@var{name} ] [ --display-unused-functions ] [ --file-format=@var{name} ]
[ --file-info ] [ --help ] [ --line ] [ --inline-file-names ] [ --file-info ] [ --help ] [ --line ] [ --inline-file-names ]
@ -132,14 +132,14 @@ gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ]
@end smallexample @end smallexample
@c man begin DESCRIPTION @c man begin DESCRIPTION
@code{gprof} produces an execution profile of C, Pascal, or Fortran77 @code{gprof} produces an execution profile of C, Pascal, or Fortran77
programs. The effect of called routines is incorporated in the profile programs. The effect of called routines is incorporated in the profile
of each caller. The profile data is taken from the call graph profile file of each caller. The profile data is taken from the call graph profile file
(@file{gmon.out} default) which is created by programs (@file{gmon.out} default) which is created by programs
that are compiled with the @samp{-pg} option of that are compiled with the @samp{-pg} option of
@code{cc}, @code{pc}, and @code{f77}. @code{cc}, @code{pc}, and @code{f77}.
The @samp{-pg} option also links in versions of the library routines The @samp{-pg} option also links in versions of the library routines
that are compiled for profiling. @code{Gprof} reads the given object that are compiled for profiling. @code{Gprof} reads the given object
file (the default is @code{a.out}) and establishes the relation between file (the default is @code{a.out}) and establishes the relation between
its symbol table and the call graph profile from @file{gmon.out}. its symbol table and the call graph profile from @file{gmon.out}.
If more than one profile file is specified, the @code{gprof} If more than one profile file is specified, the @code{gprof}
@ -184,7 +184,7 @@ the namelist and text space.
@item @file{gmon.out} @item @file{gmon.out}
dynamic call graph and profile. dynamic call graph and profile.
@item @file{gmon.sum} @item @file{gmon.sum}
summarized dynamic call graph and profile. summarized dynamic call graph and profile.
@end table @end table
@c man end @c man end
@ -303,8 +303,8 @@ graph data you will still be able to see the time samples:
Flat profile: Flat profile:
Each sample counts as 0.01 seconds. Each sample counts as 0.01 seconds.
% cumulative self self total % cumulative self self total
time seconds seconds calls Ts/call Ts/call name time seconds seconds calls Ts/call Ts/call name
44.12 0.07 0.07 zazLoop 44.12 0.07 0.07 zazLoop
35.29 0.14 0.06 main 35.29 0.14 0.06 main
20.59 0.17 0.04 bazMillion 20.59 0.17 0.04 bazMillion
@ -644,9 +644,9 @@ first line. This behavior is similar to @code{tcov}'s @samp{-a}.
@itemx --no-demangle @itemx --no-demangle
These options control whether C++ symbol names should be demangled when These options control whether C++ symbol names should be demangled when
printing output. The default is to demangle symbols. The printing output. The default is to demangle symbols. The
@code{--no-demangle} option may be used to turn off demangling. Different @code{--no-demangle} option may be used to turn off demangling. Different
compilers have different mangling styles. The optional demangling style compilers have different mangling styles. The optional demangling style
argument can be used to choose an appropriate demangling style for your argument can be used to choose an appropriate demangling style for your
compiler. compiler.
@end table @end table
@ -663,7 +663,7 @@ names are not listed as global, and which are not visible outside the
file/function/block where they were defined.) Time spent in these file/function/block where they were defined.) Time spent in these
functions, calls to/from them, etc., will all be attributed to the functions, calls to/from them, etc., will all be attributed to the
function that was loaded directly before it in the executable file. function that was loaded directly before it in the executable file.
@c This is compatible with Unix @code{gprof}, but a bad idea. @c This is compatible with Unix @code{gprof}, but a bad idea.
This option affects both the flat profile and the call graph. This option affects both the flat profile and the call graph.
@item -c @item -c
@ -732,8 +732,8 @@ not to propagate times for symbols matching @var{symspec}.
@item -S@var{filename} @item -S@var{filename}
@itemx --external-symbol-table=@var{filename} @itemx --external-symbol-table=@var{filename}
The @samp{-S} option causes @code{gprof} to read an external symbol table The @samp{-S} option causes @code{gprof} to read an external symbol table
file, such as @file{/proc/kallsyms}, rather than read the symbol table file, such as @file{/proc/kallsyms}, rather than read the symbol table
from the given object file (the default is @code{a.out}). This is useful from the given object file (the default is @code{a.out}). This is useful
for profiling kernel modules. for profiling kernel modules.
@item -z @item -z
@ -799,7 +799,7 @@ children@dots{}) in the call graph. The function will still be listed
as a child of any functions that call it, but its index number will be as a child of any functions that call it, but its index number will be
shown as @samp{[not printed]}. More than one @samp{-e} option may be shown as @samp{[not printed]}. More than one @samp{-e} option may be
given; only one @var{function_name} may be indicated with each @samp{-e} given; only one @var{function_name} may be indicated with each @samp{-e}
option. option.
@item -E @var{function_name} @item -E @var{function_name}
The @code{-E @var{function}} option works like the @code{-e} option, but The @code{-E @var{function}} option works like the @code{-e} option, but
@ -813,7 +813,7 @@ The @samp{-f @var{function}} option causes @code{gprof} to limit the
call graph to the function @var{function_name} and its children (and call graph to the function @var{function_name} and its children (and
their children@dots{}). More than one @samp{-f} option may be given; their children@dots{}). More than one @samp{-f} option may be given;
only one @var{function_name} may be indicated with each @samp{-f} only one @var{function_name} may be indicated with each @samp{-f}
option. option.
@item -F @var{function_name} @item -F @var{function_name}
The @samp{-F @var{function}} option works like the @code{-f} option, but The @samp{-F @var{function}} option works like the @code{-f} option, but
@ -933,8 +933,8 @@ This is part of a flat profile for a small program:
Flat profile: Flat profile:
Each sample counts as 0.01 seconds. Each sample counts as 0.01 seconds.
% cumulative self self total % cumulative self self total
time seconds seconds calls ms/call ms/call name time seconds seconds calls ms/call ms/call name
33.34 0.02 0.02 7208 0.00 0.00 open 33.34 0.02 0.02 7208 0.00 0.00 open
16.67 0.03 0.01 244 0.04 0.12 offtime 16.67 0.03 0.01 244 0.04 0.12 offtime
16.67 0.04 0.01 8 1.25 1.25 memccpy 16.67 0.04 0.01 8 1.25 1.25 memccpy
@ -1087,7 +1087,7 @@ function and the following lines describe its subroutines (also called
The entries are sorted by time spent in the function and its subroutines. The entries are sorted by time spent in the function and its subroutines.
The internal profiling function @code{mcount} (@pxref{Flat Profile, ,The The internal profiling function @code{mcount} (@pxref{Flat Profile, ,The
Flat Profile}) is never mentioned in the call graph. Flat Profile}) is never mentioned in the call graph.
@menu @menu
@ -1449,8 +1449,8 @@ Note that @code{ct_init} accounted for four histogram hits, and
Flat profile: Flat profile:
Each sample counts as 0.01 seconds. Each sample counts as 0.01 seconds.
% cumulative self self total % cumulative self self total
time seconds seconds calls us/call us/call name time seconds seconds calls us/call us/call name
30.77 0.13 0.04 6335 6.31 6.31 ct_init 30.77 0.13 0.04 6335 6.31 6.31 ct_init
@ -1482,8 +1482,8 @@ from line 385, and 6525 calls from 387.
Flat profile: Flat profile:
Each sample counts as 0.01 seconds. Each sample counts as 0.01 seconds.
% cumulative self % cumulative self
time seconds seconds calls name time seconds seconds calls name
7.69 0.10 0.01 ct_init (trees.c:349) 7.69 0.10 0.01 ct_init (trees.c:349)
7.69 0.11 0.01 ct_init (trees.c:351) 7.69 0.11 0.01 ct_init (trees.c:351)
7.69 0.12 0.01 ct_init (trees.c:382) 7.69 0.12 0.01 ct_init (trees.c:382)
@ -1576,9 +1576,9 @@ annotated source listing for a sample @code{gzip} run:
unsigned n; unsigned n;
2 ->@{ 2 ->@{
register ulg c; register ulg c;
static ulg crc = (ulg)0xffffffffL; static ulg crc = (ulg)0xffffffffL;
2 -> if (s == NULL) @{ 2 -> if (s == NULL) @{
1 -> c = 0xffffffffL; 1 -> c = 0xffffffffL;
1 -> @} else @{ 1 -> @} else @{
@ -1885,7 +1885,7 @@ more overhead than kernel-based profiling. Also, due to the
added delay required to deliver the signal, this method is added delay required to deliver the signal, this method is
less accurate as well. less accurate as well.
A special startup routine allocates memory for the histogram and A special startup routine allocates memory for the histogram and
either calls @code{profil()} or sets up either calls @code{profil()} or sets up
a clock signal handler. a clock signal handler.
This routine (@code{monstartup}) can be invoked in several ways. This routine (@code{monstartup}) can be invoked in several ways.
@ -2099,7 +2099,7 @@ When multiple profile data files (or files with multiple histogram
records) are read, the memory ranges of each pair of histogram records records) are read, the memory ranges of each pair of histogram records
must be either equal, or non-overlapping. For each pair of histogram must be either equal, or non-overlapping. For each pair of histogram
records, the resolution (memory region size divided by the number of records, the resolution (memory region size divided by the number of
bins) must be the same. The time unit must be the same for all bins) must be the same. The time unit must be the same for all
histogram records. If the above containts are met, all histograms histogram records. If the above containts are met, all histograms
for the same memory range are merged. for the same memory range are merged.

View File

@ -80,14 +80,14 @@ SItab[] =
/* Reads just the header part of histogram record into /* Reads just the header part of histogram record into
*RECORD from IFP. FILENAME is the name of IFP and *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, If FIRST is non-zero, sets global variables HZ, HIST_DIMENSION,
HIST_DIMENSION_ABBREV, HIST_SCALE. If FIRST is zero, checks HIST_DIMENSION_ABBREV, HIST_SCALE. If FIRST is zero, checks
that the new histogram is compatible with already-set values that the new histogram is compatible with already-set values
of those variables and emits an error if that's not so. */ of those variables and emits an error if that's not so. */
static void static void
read_histogram_header (histogram *record, read_histogram_header (histogram *record,
FILE *ifp, const char *filename, FILE *ifp, const char *filename,
int first) int first)
{ {
@ -109,7 +109,7 @@ read_histogram_header (histogram *record,
done (1); 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; / record->num_bins;
if (first) if (first)
@ -124,13 +124,13 @@ read_histogram_header (histogram *record,
hz = profrate; hz = profrate;
memcpy (hist_dimension, n_hist_dimension, 15); memcpy (hist_dimension, n_hist_dimension, 15);
hist_dimension_abbrev = n_hist_dimension_abbrev; hist_dimension_abbrev = n_hist_dimension_abbrev;
hist_scale = n_hist_scale; hist_scale = n_hist_scale;
} }
else else
{ {
if (strncmp (n_hist_dimension, hist_dimension, 15) != 0) if (strncmp (n_hist_dimension, hist_dimension, 15) != 0)
{ {
fprintf (stderr, fprintf (stderr,
_("%s: dimension unit changed between histogram records\n" _("%s: dimension unit changed between histogram records\n"
"%s: from '%s'\n" "%s: from '%s'\n"
"%s: to '%s'\n"), "%s: to '%s'\n"),
@ -140,12 +140,12 @@ read_histogram_header (histogram *record,
if (n_hist_dimension_abbrev != hist_dimension_abbrev) if (n_hist_dimension_abbrev != hist_dimension_abbrev)
{ {
fprintf (stderr, fprintf (stderr,
_("%s: dimension abbreviation changed between histogram records\n" _("%s: dimension abbreviation changed between histogram records\n"
"%s: from '%c'\n" "%s: from '%c'\n"
"%s: to '%c'\n"), "%s: to '%c'\n"),
whoami, whoami, hist_dimension_abbrev, whoami, n_hist_dimension_abbrev); 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 /* 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. */ things for different functions. */
if (fabs (hist_scale - n_hist_scale) > 0.000001) if (fabs (hist_scale - n_hist_scale) > 0.000001)
{ {
fprintf (stderr, fprintf (stderr,
_("%s: different scales in histogram records"), _("%s: different scales in histogram records"),
whoami); whoami);
done (1); done (1);
} }
} }
} }
@ -191,10 +191,10 @@ hist_read_rec (FILE * ifp, const char *filename)
hist_clip_symbol_address (&lowpc, &highpc); hist_clip_symbol_address (&lowpc, &highpc);
if (lowpc != highpc) if (lowpc != highpc)
{ {
fprintf (stderr, fprintf (stderr,
_("%s: overlapping histogram records\n"), _("%s: overlapping histogram records\n"),
whoami); whoami);
done (1); done (1);
} }
/* This is new record. Add it to global array and allocate space for /* 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)); xrealloc (histograms, sizeof (histogram) * (num_histograms + 1));
memcpy (histograms + num_histograms, memcpy (histograms + num_histograms,
&n_record, sizeof (histogram)); &n_record, sizeof (histogram));
record = &histograms[num_histograms]; record = &histograms[num_histograms];
++num_histograms; ++num_histograms;
record->sample = (int *) xmalloc (record->num_bins record->sample = (int *) xmalloc (record->num_bins
* sizeof (record->sample[0])); * sizeof (record->sample[0]));
memset (record->sample, 0, 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, DBG (SAMPLEDEBUG,
printf ("[hist_read_rec] n_lowpc 0x%lx n_highpc 0x%lx ncnt %u\n", 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)); record->num_bins));
for (i = 0; i < record->num_bins; ++i) for (i = 0; i < record->num_bins; ++i)
{ {
UNIT count; 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]); record->sample[i] += bfd_get_16 (core_bfd, (bfd_byte *) & count[0]);
DBG (SAMPLEDEBUG, DBG (SAMPLEDEBUG,
printf ("[hist_read_rec] 0x%lx: %u\n", printf ("[hist_read_rec] 0x%lx: %u\n",
(unsigned long) (record->lowpc (unsigned long) (record->lowpc
+ i * (record->highpc - record->lowpc) + i * (record->highpc - record->lowpc)
/ record->num_bins), / record->num_bins),
record->sample[i])); record->sample[i]));
} }
@ -255,7 +255,7 @@ hist_write_hist (FILE * ofp, const char *filename)
histogram *record = &histograms[r]; histogram *record = &histograms[r];
/* Write header. */ /* Write header. */
if (gmon_io_write_8 (ofp, GMON_TAG_TIME_HIST) if (gmon_io_write_8 (ofp, GMON_TAG_TIME_HIST)
|| gmon_io_write_vma (ofp, record->lowpc) || gmon_io_write_vma (ofp, record->lowpc)
|| gmon_io_write_vma (ofp, record->highpc) || gmon_io_write_vma (ofp, record->highpc)
@ -267,11 +267,11 @@ hist_write_hist (FILE * ofp, const char *filename)
perror (filename); perror (filename);
done (1); done (1);
} }
for (i = 0; i < record->num_bins; ++i) for (i = 0; i < record->num_bins; ++i)
{ {
bfd_put_16 (core_bfd, (bfd_vma) record->sample[i], (bfd_byte *) &count[0]); bfd_put_16 (core_bfd, (bfd_vma) record->sample[i], (bfd_byte *) &count[0]);
if (fwrite (&count[0], sizeof (count), 1, ofp) != 1) if (fwrite (&count[0], sizeof (count), 1, ofp) != 1)
{ {
perror (filename); perror (filename);
@ -453,7 +453,7 @@ hist_assign_samples ()
for (i = 0; i < num_histograms; ++i) for (i = 0; i < num_histograms; ++i)
hist_assign_samples_1 (&histograms[i]); hist_assign_samples_1 (&histograms[i]);
} }
/* Print header for flag histogram profile. */ /* Print header for flag histogram profile. */
@ -637,7 +637,7 @@ hist_print ()
{ {
double scaled_value = SItab[log_scale].scale * top_time; 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; break;
} }
} }
@ -675,7 +675,7 @@ hist_check_address (unsigned address)
if (histograms[i].lowpc <= address && address < histograms[i].highpc) if (histograms[i].lowpc <= address && address < histograms[i].highpc)
return 1; return 1;
return 0; return 0;
} }
#if ! defined(min) #if ! defined(min)
@ -750,5 +750,5 @@ find_histogram_for_pc (bfd_vma pc)
if (histograms[i].lowpc <= pc && pc < histograms[i].highpc) if (histograms[i].lowpc <= pc && pc < histograms[i].highpc)
return &histograms[i]; return &histograms[i];
} }
return 0; return 0;
} }

View File

@ -46,10 +46,10 @@ extern void hist_print (void);
we have histogram data. Returns 1 if so and 0 otherwise. */ we have histogram data. Returns 1 if so and 0 otherwise. */
extern int hist_check_address (unsigned address); extern int hist_check_address (unsigned address);
/* Given a range of addresses for a symbol, find a histogram record /* Given a range of addresses for a symbol, find a histogram record
that intersects with this range, and clips the range to that that intersects with this range, and clips the range to that
histogram record, modifying *P_LOWPC and *P_HIGHPC. histogram record, modifying *P_LOWPC and *P_HIGHPC.
If no intersection is found, *P_LOWPC and *P_HIGHPC will be set to If no intersection is found, *P_LOWPC and *P_HIGHPC will be set to
one unspecified value. If more that one intersection is found, one unspecified value. If more that one intersection is found,
an error is emitted. */ an error is emitted. */