]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
perf_counter tools: Standardize color printing
authorIngo Molnar <mingo@elte.hu>
Mon, 8 Jun 2009 21:15:28 +0000 (23:15 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 8 Jun 2009 21:15:28 +0000 (23:15 +0200)
The rule is:

 - high overhead: red
 -  mid overhead: green
 -  low overhead: normal (white/black)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/builtin-top.c

index 0e23fe98ec4ec8da0ca26131a5bd96f8a957b6ef..3334a8bb1d513870c7b0c73cf04455f61f0a89ca 100644 (file)
@@ -1085,8 +1085,9 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
                        percent = 100.0 * hits / sym->hist_sum;
 
                /*
-                * We color high-overhead entries in red, low-overhead
-                * entries in green - and keep the middle ground normal:
+                * We color high-overhead entries in red, mid-overhead
+                * entries in green - and keep the low overhead places
+                * normal:
                 */
                if (percent >= 5.0)
                        color = PERF_COLOR_RED;
index 61d871849b4460ac67bb5885b5979c77c26fe294..0b18cb99a858edbecbd9316ec9de47bec29c545e 100644 (file)
@@ -693,13 +693,16 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
                char *color = PERF_COLOR_NORMAL;
 
                /*
-                * We color high-overhead entries in red, low-overhead
-                * entries in green - and keep the middle ground normal:
+                * We color high-overhead entries in red, mid-overhead
+                * entries in green - and keep the low overhead places
+                * normal:
                 */
-               if (percent >= 5.0)
+               if (percent >= 5.0) {
                        color = PERF_COLOR_RED;
-               if (percent < 0.5)
-                       color = PERF_COLOR_GREEN;
+               } else {
+                       if (percent >= 0.5)
+                               color = PERF_COLOR_GREEN;
+               }
 
                ret = color_fprintf(fp, color, "   %6.2f%%",
                                (self->count * 100.0) / total_samples);
index be1698f1189b7546659adb38bf90a6dc8928f562..8ba24808a3921dd19a0dd144a034cb691787b5f2 100644 (file)
@@ -248,13 +248,16 @@ static void print_sym_table(void)
                                         sum_ksamples));
 
                /*
-                * We color high-overhead entries in red, low-overhead
-                * entries in green - and keep the middle ground normal:
+                * We color high-overhead entries in red, mid-overhead
+                * entries in green - and keep the low overhead places
+                * normal:
                 */
-               if (pcnt >= 5.0)
+               if (pcnt >= 5.0) {
                        color = PERF_COLOR_RED;
-               if (pcnt < 0.5)
-                       color = PERF_COLOR_GREEN;
+               } else {
+                       if (pcnt >= 0.5)
+                               color = PERF_COLOR_GREEN;
+               }
 
                if (nr_counters == 1)
                        printf("%20.2f - ", syme->weight);