On 9/17/18 8:41 PM, David Malcolm wrote: > On Wed, 2018-09-12 at 14:36 +0200, Martin Liška wrote: >> Hi. >> >> This is follow-up of: >> https://gcc.gnu.org/ml/gcc/2018-08/msg00162.html >> >> I'm suggesting to introduce using colors in order to indicate hotness >> of lines. Legend is printed at the very beginning of the output file. >> Example: https://pasteboard.co/HDxK4Nm.png > > One comment: color seems to be being used for two different purposes: > (a) in the left-hand column (presumably the profile count), where e.g. > lines that are 0 are being marked as red > (b) in the middle column (the line number), lines that are > 50% are > being marked as red. > > So red seems to be being used both for very hot lines (for the line > number), and for unexecuted lines (for the profile count).
Thanks for review David. Yes, it's used for 2 purposes. > > Perhaps the "hotness legend" could instead say something like: > > Colorization: profile count: blah blah blah > Colorization: line numbers: hotness: > 50 % > 20% > 10% > > to explain both colorization schemes? (I'm not in love with the above > wording, but hopefully the idea makes sense). I welcome that, now one can see: -: 0:Colorization: profile count: zero coverage (exceptional) zero coverage (unexceptional) unexecuted block -: 0:Colorization: line numbers: hotness: > 50% > 20% > 10% ... Hope it's an improvement. Martin > >> Patch survives gcov.exp test-suite. Will install next week if no >> objections. >> >> Martin >> >> gcc/ChangeLog: >> >> 2018-09-12 Martin Liska <mli...@suse.cz> >> >> * doc/gcov.texi: Document new option --use-hotness-colors. >> * gcov.c (struct source_info): Declare new field. >> (source_info::source_info): Set default for maximum_count. >> (print_usage): Add new -q option. >> (process_args): Process it. >> (accumulate_line_info): Save src->maximum_count. >> (output_line_beginning): Make color line number if >> flag_use_hotness_colors is set. >> (output_line_details): Pass default argument value. >> (output_lines): Pass src->maximum_count. >> --- >> gcc/doc/gcov.texi | 8 ++++++- >> gcc/gcov.c | 56 +++++++++++++++++++++++++++++++++++++++++-- >> ---- >> 2 files changed, 56 insertions(+), 8 deletions(-) >> >>
>From 3e826e7b4b09a7130ee88122d54fb35ad41b044f Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Tue, 18 Sep 2018 12:48:16 +0200 Subject: [PATCH] Improve colorization legen in gcov reports. gcc/ChangeLog: 2018-09-18 Martin Liska <mli...@suse.cz> * gcov.c (output_lines): Print colorization legend for both flag_use_colors and flag_use_hotness_colors. Reword the help. --- gcc/gcov.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index c09d5060053..0de14dc52af 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -2935,9 +2935,19 @@ output_lines (FILE *gcov_file, const source_info *src) FILE *source_file; const char *retval; - /* Print legend of color hotness syntax. */ + /* Print colorization legend. */ + if (flag_use_colors) + fprintf (gcov_file, "%s", + DEFAULT_LINE_START "Colorization: profile count: " \ + SGR_SEQ (COLOR_BG_CYAN) "zero coverage (exceptional)" SGR_RESET \ + " " \ + SGR_SEQ (COLOR_BG_RED) "zero coverage (unexceptional)" SGR_RESET \ + " " \ + SGR_SEQ (COLOR_BG_MAGENTA) "unexecuted block" SGR_RESET "\n"); + if (flag_use_hotness_colors) - fprintf (gcov_file, "%s", DEFAULT_LINE_START "Hotness legend: " \ + fprintf (gcov_file, "%s", + DEFAULT_LINE_START "Colorization: line numbers: hotness: " \ SGR_SEQ (COLOR_BG_RED) "> 50%" SGR_RESET " " \ SGR_SEQ (COLOR_BG_YELLOW) "> 20%" SGR_RESET " " \ SGR_SEQ (COLOR_BG_GREEN) "> 10%" SGR_RESET "\n"); -- 2.18.0