diff options
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 08ea6c5329d9..5f9eefecc574 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -25,10 +25,6 @@ | |||
25 | #define SHOW_USER 2 | 25 | #define SHOW_USER 2 |
26 | #define SHOW_HV 4 | 26 | #define SHOW_HV 4 |
27 | 27 | ||
28 | #define MIN_GREEN 0.5 | ||
29 | #define MIN_RED 5.0 | ||
30 | |||
31 | |||
32 | static char const *input_name = "perf.data"; | 28 | static char const *input_name = "perf.data"; |
33 | static char *vmlinux = "vmlinux"; | 29 | static char *vmlinux = "vmlinux"; |
34 | 30 | ||
@@ -1047,24 +1043,6 @@ process_event(event_t *event, unsigned long offset, unsigned long head) | |||
1047 | return 0; | 1043 | return 0; |
1048 | } | 1044 | } |
1049 | 1045 | ||
1050 | static char *get_color(double percent) | ||
1051 | { | ||
1052 | char *color = PERF_COLOR_NORMAL; | ||
1053 | |||
1054 | /* | ||
1055 | * We color high-overhead entries in red, mid-overhead | ||
1056 | * entries in green - and keep the low overhead places | ||
1057 | * normal: | ||
1058 | */ | ||
1059 | if (percent >= MIN_RED) | ||
1060 | color = PERF_COLOR_RED; | ||
1061 | else { | ||
1062 | if (percent > MIN_GREEN) | ||
1063 | color = PERF_COLOR_GREEN; | ||
1064 | } | ||
1065 | return color; | ||
1066 | } | ||
1067 | |||
1068 | static int | 1046 | static int |
1069 | parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) | 1047 | parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) |
1070 | { | 1048 | { |
@@ -1126,7 +1104,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) | |||
1126 | } else if (sym->hist_sum) | 1104 | } else if (sym->hist_sum) |
1127 | percent = 100.0 * hits / sym->hist_sum; | 1105 | percent = 100.0 * hits / sym->hist_sum; |
1128 | 1106 | ||
1129 | color = get_color(percent); | 1107 | color = get_percent_color(percent); |
1130 | 1108 | ||
1131 | /* | 1109 | /* |
1132 | * Also color the filename and line if needed, with | 1110 | * Also color the filename and line if needed, with |
@@ -1262,7 +1240,7 @@ static void print_summary(char *filename) | |||
1262 | 1240 | ||
1263 | sym_ext = rb_entry(node, struct sym_ext, node); | 1241 | sym_ext = rb_entry(node, struct sym_ext, node); |
1264 | percent = sym_ext->percent; | 1242 | percent = sym_ext->percent; |
1265 | color = get_color(percent); | 1243 | color = get_percent_color(percent); |
1266 | path = sym_ext->path; | 1244 | path = sym_ext->path; |
1267 | 1245 | ||
1268 | color_fprintf(stdout, color, " %7.2f %s", percent, path); | 1246 | color_fprintf(stdout, color, " %7.2f %s", percent, path); |