summaryrefslogtreecommitdiff
path: root/tools/perf/util/color.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-07-31 14:47:36 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-08-12 12:03:05 -0300
commitd675107ce6fa988102851e0b0ef06e46c8aa7ac6 (patch)
tree202b4df2114ddd4ca6d6f796f4a523996d2e71d7 /tools/perf/util/color.c
parent8246de88e95ddef7508f5601d7af85c3ab9e476b (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/util/color.c')
-rw-r--r--tools/perf/util/color.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 87b8672eb413..f4654183d391 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -335,3 +335,19 @@ int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
va_end(args);
return value_color_snprintf(bf, size, fmt, percent);
}
+
+int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...)
+{
+ va_list args;
+ int len;
+ double percent;
+ const char *color;
+
+ va_start(args, fmt);
+ len = va_arg(args, int);
+ percent = va_arg(args, double);
+ va_end(args);
+
+ color = get_percent_color(percent);
+ return color_snprintf(bf, size, color, fmt, len, percent);
+}