diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-07-31 01:47:36 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-12 11:03:05 -0400 |
commit | d675107ce6fa988102851e0b0ef06e46c8aa7ac6 (patch) | |
tree | 202b4df2114ddd4ca6d6f796f4a523996d2e71d7 /tools/perf/ui/gtk/hists.c | |
parent | 8246de88e95ddef7508f5601d7af85c3ab9e476b (diff) |
perf tools: Make __hpp__fmt() receive an additional len argument
So that it can properly handle alignment requirements later. To do
that, add percent_color_len_snprintf() fucntion to help coloring of
overhead columns.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1406785662-5534-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/gtk/hists.c')
-rw-r--r-- | tools/perf/ui/gtk/hists.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 6ca60e482cdc..91f6cd7d2312 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c | |||
@@ -11,6 +11,7 @@ | |||
11 | static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...) | 11 | static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...) |
12 | { | 12 | { |
13 | int ret = 0; | 13 | int ret = 0; |
14 | int len; | ||
14 | va_list args; | 15 | va_list args; |
15 | double percent; | 16 | double percent; |
16 | const char *markup; | 17 | const char *markup; |
@@ -18,6 +19,7 @@ static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...) | |||
18 | size_t size = hpp->size; | 19 | size_t size = hpp->size; |
19 | 20 | ||
20 | va_start(args, fmt); | 21 | va_start(args, fmt); |
22 | len = va_arg(args, int); | ||
21 | percent = va_arg(args, double); | 23 | percent = va_arg(args, double); |
22 | va_end(args); | 24 | va_end(args); |
23 | 25 | ||
@@ -25,7 +27,7 @@ static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...) | |||
25 | if (markup) | 27 | if (markup) |
26 | ret += scnprintf(buf, size, markup); | 28 | ret += scnprintf(buf, size, markup); |
27 | 29 | ||
28 | ret += scnprintf(buf + ret, size - ret, fmt, percent); | 30 | ret += scnprintf(buf + ret, size - ret, fmt, len, percent); |
29 | 31 | ||
30 | if (markup) | 32 | if (markup) |
31 | ret += scnprintf(buf + ret, size - ret, "</span>"); | 33 | ret += scnprintf(buf + ret, size - ret, "</span>"); |
@@ -43,7 +45,7 @@ static int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, | |||
43 | struct perf_hpp *hpp, \ | 45 | struct perf_hpp *hpp, \ |
44 | struct hist_entry *he) \ | 46 | struct hist_entry *he) \ |
45 | { \ | 47 | { \ |
46 | return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \ | 48 | return __hpp__fmt(hpp, he, he_get_##_field, " %*.2f%%", 6, \ |
47 | __percent_color_snprintf, true); \ | 49 | __percent_color_snprintf, true); \ |
48 | } | 50 | } |
49 | 51 | ||
@@ -57,7 +59,7 @@ static int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, | |||
57 | struct perf_hpp *hpp, \ | 59 | struct perf_hpp *hpp, \ |
58 | struct hist_entry *he) \ | 60 | struct hist_entry *he) \ |
59 | { \ | 61 | { \ |
60 | return __hpp__fmt_acc(hpp, he, he_get_acc_##_field, " %6.2f%%", \ | 62 | return __hpp__fmt_acc(hpp, he, he_get_acc_##_field, " %*.2f%%", 6, \ |
61 | __percent_color_snprintf, true); \ | 63 | __percent_color_snprintf, true); \ |
62 | } | 64 | } |
63 | 65 | ||