diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-03-21 12:31:10 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-03-21 12:31:10 +0000 |
commit | f5d39c3d74dc91f2faf190114251226cc1f8b433 (patch) | |
tree | b8c8216b7c4c768f8df9ca92f9ef59d19256a99a /gcc | |
parent | e1283056b23aa2cc1060abb74c5b42f102780b7b (diff) | |
download | gcc-f5d39c3d74dc91f2faf190114251226cc1f8b433.zip gcc-f5d39c3d74dc91f2faf190114251226cc1f8b433.tar.gz gcc-f5d39c3d74dc91f2faf190114251226cc1f8b433.tar.bz2 |
re PR other/20564 (gcov default behaviour changed)
PR other/20564
* gcov.c (output_lines): Only output function block summary when
outputting branch information.
* doc/gcov.texi: Document format of preamble and additional block
information lines.
From-SVN: r96788
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/doc/gcov.texi | 32 | ||||
-rw-r--r-- | gcc/gcov.c | 9 |
3 files changed, 41 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fc3d94..2e947ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-21 Nathan Sidwell <nathan@codesourcery.com> + + PR other/20564 + * gcov.c (output_lines): Only output function block summary when + outputting branch information. + * doc/gcov.texi: Document format of preamble and additional block + information lines. + 2005-03-21 Richard Sandiford <rsandifo@redhat.com> * libgcc2.h (LIBGCC2_HAS_SF_MODE): New macro. @@ -240,7 +248,6 @@ scale_bbs_frequencies_int. * tree-ssa-loop-ch.c (copy_loop_headers): Fix profiling info. ->>>>>>> 2.7929 2005-03-18 Kazu Hirata <kazu@cs.umass.edu> * config/m32r/m32r-protos.h: Remove the prototypes for @@ -488,6 +495,7 @@ (arc_rodata_string, TARGET_OPTIONS): Delete. * config/arc/arc.opt: New file. +>>>>>>> 2.7930 2005-03-17 Richard Henderson <rth@redhat.com> * doc/extend.texi (Weak Pragmas): New section. diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index 3278a4b..bfe4a3d 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -207,7 +207,7 @@ option is not supplied, it defaults to the current directory. @item -u @itemx --unconditional-branches -When branch counts are given, include those of unconditional branches. +When branch probabilities are given, include those of unconditional branches. Unconditional branches are normally not interesting. @end table @@ -232,9 +232,27 @@ program source code. The format is Additional block information may succeed each line, when requested by command line option. The @var{execution_count} is @samp{-} for lines -containing no code and @samp{#####} for lines which were never -executed. Some lines of information at the start have @var{line_number} -of zero. +containing no code and @samp{#####} for lines which were never executed. +Some lines of information at the start have @var{line_number} of zero. + +The preamble lines are of the form + +@smallexample +-:0:@var{tag}:@var{value} +@end smallexample + +The ordering and number of these preamble lines will be augmented as +@command{gcov} development progresses --- do not rely on them remaining +unchanged. Use @var{tag} to locate a particular preamble line. + +The additional block information is of the form + +@smallexample +@var{tag} @var{information} +@end smallexample + +The @var{information} is human readable, but designed to be simple +enough for machine parsing too. When printing percentages, 0% and 100% are only printed when the values are @emph{exactly} 0% and 100% respectively. Other values which would @@ -278,7 +296,6 @@ Here is a sample: -: 1:#include <stdio.h> -: 2: -: 3:int main (void) -function main called 1 returned 1 blocks executed 75% 1: 4:@{ 1: 5: int i, total; -: 6: @@ -307,7 +324,6 @@ counts, and the output looks like this: -: 1:#include <stdio.h> -: 2: -: 3:int main (void) -function main called 1 returned 1 blocks executed 75% 1: 4:@{ 1: 4-block 0 1: 5: int i, total; @@ -390,6 +406,10 @@ call 0 called 1 returned 100% -: 17:@} @end smallexample +For each function, a line is printed showing how many times the function +is called, how many times it returns and what percentage of the +function's blocks were executed. + For each basic block, a line is printed after the last line of the basic block describing the branch or call that ends the basic block. There can be multiple branches and calls listed for a single source line if there @@ -1774,7 +1774,7 @@ output_lines (FILE *gcov_file, const source_t *src) const line_t *line; /* current line info ptr. */ char string[STRING_SIZE]; /* line buffer. */ char const *retval = ""; /* status of source file reading. */ - function_t *fn = src->functions; + function_t *fn = NULL; fprintf (gcov_file, "%9s:%5d:Source:%s\n", "-", 0, src->name); fprintf (gcov_file, "%9s:%5d:Graph:%s\n", "-", 0, bbg_file_name); @@ -1803,6 +1803,9 @@ output_lines (FILE *gcov_file, const source_t *src) } } + if (flag_branches) + fn = src->functions; + for (line_num = 1, line = &src->lines[line_num]; line_num < src->num_lines; line_num++, line++) { @@ -1810,11 +1813,11 @@ output_lines (FILE *gcov_file, const source_t *src) { arc_t *arc = fn->blocks[fn->num_blocks - 1].pred; gcov_type return_count = fn->blocks[fn->num_blocks - 1].count; - + for (; arc; arc = arc->pred_next) if (arc->fake) return_count -= arc->count; - + fprintf (gcov_file, "function %s", fn->name); fprintf (gcov_file, " called %s", format_gcov (fn->blocks[0].count, 0, -1)); |