summaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/gtk
diff options
context:
space:
mode:
authorNamhyung Kim2014-07-31 07:47:36 +0200
committerArnaldo Carvalho de Melo2014-08-12 17:03:05 +0200
commitd675107ce6fa988102851e0b0ef06e46c8aa7ac6 (patch)
tree202b4df2114ddd4ca6d6f796f4a523996d2e71d7 /tools/perf/ui/gtk
parentperf tools: Left-align output contents (diff)
downloadkernel-qcow2-linux-d675107ce6fa988102851e0b0ef06e46c8aa7ac6.tar.gz
kernel-qcow2-linux-d675107ce6fa988102851e0b0ef06e46c8aa7ac6.tar.xz
kernel-qcow2-linux-d675107ce6fa988102851e0b0ef06e46c8aa7ac6.zip
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')
-rw-r--r--tools/perf/ui/gtk/hists.c8
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 @@
static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...)
{
int ret = 0;
+ int len;
va_list args;
double percent;
const char *markup;
@@ -18,6 +19,7 @@ static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...)
size_t size = hpp->size;
va_start(args, fmt);
+ len = va_arg(args, int);
percent = va_arg(args, double);
va_end(args);
@@ -25,7 +27,7 @@ static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...)
if (markup)
ret += scnprintf(buf, size, markup);
- ret += scnprintf(buf + ret, size - ret, fmt, percent);
+ ret += scnprintf(buf + ret, size - ret, fmt, len, percent);
if (markup)
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,
struct perf_hpp *hpp, \
struct hist_entry *he) \
{ \
- return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \
+ return __hpp__fmt(hpp, he, he_get_##_field, " %*.2f%%", 6, \
__percent_color_snprintf, true); \
}
@@ -57,7 +59,7 @@ static int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt __maybe_unused,
struct perf_hpp *hpp, \
struct hist_entry *he) \
{ \
- return __hpp__fmt_acc(hpp, he, he_get_acc_##_field, " %6.2f%%", \
+ return __hpp__fmt_acc(hpp, he, he_get_acc_##_field, " %*.2f%%", 6, \
__percent_color_snprintf, true); \
}