aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-08 17:15:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-08 17:15:28 -0400
commitaefcf37b82886260d8540c9fb815e613c8977e06 (patch)
tree8630ed802497d965edbc0c05b8599f805fa0cb47 /tools
parent80d496be89ed7dede5abee5c057634e80a31c82d (diff)
perf_counter tools: Standardize color printing
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-annotate.c5
-rw-r--r--tools/perf/builtin-report.c13
-rw-r--r--tools/perf/builtin-top.c13
3 files changed, 19 insertions, 12 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 0e23fe98ec4e..3334a8bb1d51 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -1085,8 +1085,9 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
1085 percent = 100.0 * hits / sym->hist_sum; 1085 percent = 100.0 * hits / sym->hist_sum;
1086 1086
1087 /* 1087 /*
1088 * We color high-overhead entries in red, low-overhead 1088 * We color high-overhead entries in red, mid-overhead
1089 * entries in green - and keep the middle ground normal: 1089 * entries in green - and keep the low overhead places
1090 * normal:
1090 */ 1091 */
1091 if (percent >= 5.0) 1092 if (percent >= 5.0)
1092 color = PERF_COLOR_RED; 1093 color = PERF_COLOR_RED;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 61d871849b44..0b18cb99a858 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -693,13 +693,16 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
693 char *color = PERF_COLOR_NORMAL; 693 char *color = PERF_COLOR_NORMAL;
694 694
695 /* 695 /*
696 * We color high-overhead entries in red, low-overhead 696 * We color high-overhead entries in red, mid-overhead
697 * entries in green - and keep the middle ground normal: 697 * entries in green - and keep the low overhead places
698 * normal:
698 */ 699 */
699 if (percent >= 5.0) 700 if (percent >= 5.0) {
700 color = PERF_COLOR_RED; 701 color = PERF_COLOR_RED;
701 if (percent < 0.5) 702 } else {
702 color = PERF_COLOR_GREEN; 703 if (percent >= 0.5)
704 color = PERF_COLOR_GREEN;
705 }
703 706
704 ret = color_fprintf(fp, color, " %6.2f%%", 707 ret = color_fprintf(fp, color, " %6.2f%%",
705 (self->count * 100.0) / total_samples); 708 (self->count * 100.0) / total_samples);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index be1698f1189b..8ba24808a392 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -248,13 +248,16 @@ static void print_sym_table(void)
248 sum_ksamples)); 248 sum_ksamples));
249 249
250 /* 250 /*
251 * We color high-overhead entries in red, low-overhead 251 * We color high-overhead entries in red, mid-overhead
252 * entries in green - and keep the middle ground normal: 252 * entries in green - and keep the low overhead places
253 * normal:
253 */ 254 */
254 if (pcnt >= 5.0) 255 if (pcnt >= 5.0) {
255 color = PERF_COLOR_RED; 256 color = PERF_COLOR_RED;
256 if (pcnt < 0.5) 257 } else {
257 color = PERF_COLOR_GREEN; 258 if (pcnt >= 0.5)
259 color = PERF_COLOR_GREEN;
260 }
258 261
259 if (nr_counters == 1) 262 if (nr_counters == 1)
260 printf("%20.2f - ", syme->weight); 263 printf("%20.2f - ", syme->weight);