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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
8246de88e9
commit
d675107ce6
@@ -653,17 +653,18 @@ struct hpp_arg {
|
||||
static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt, ...)
|
||||
{
|
||||
struct hpp_arg *arg = hpp->ptr;
|
||||
int ret;
|
||||
int ret, len;
|
||||
va_list args;
|
||||
double percent;
|
||||
|
||||
va_start(args, fmt);
|
||||
len = va_arg(args, int);
|
||||
percent = va_arg(args, double);
|
||||
va_end(args);
|
||||
|
||||
ui_browser__set_percent_color(arg->b, percent, arg->current_entry);
|
||||
|
||||
ret = scnprintf(hpp->buf, hpp->size, fmt, percent);
|
||||
ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent);
|
||||
slsmg_printf("%s", hpp->buf);
|
||||
|
||||
advance_hpp(hpp, ret);
|
||||
@@ -681,7 +682,7 @@ hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt __maybe_unused,\
|
||||
struct perf_hpp *hpp, \
|
||||
struct hist_entry *he) \
|
||||
{ \
|
||||
return __hpp__fmt(hpp, he, __hpp_get_##_field, " %6.2f%%", \
|
||||
return __hpp__fmt(hpp, he, __hpp_get_##_field, " %*.2f%%", 6, \
|
||||
__hpp__slsmg_color_printf, true); \
|
||||
}
|
||||
|
||||
@@ -697,13 +698,14 @@ hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt __maybe_unused,\
|
||||
struct hist_entry *he) \
|
||||
{ \
|
||||
if (!symbol_conf.cumulate_callchain) { \
|
||||
int ret = scnprintf(hpp->buf, hpp->size, "%8s", "N/A"); \
|
||||
int ret = scnprintf(hpp->buf, hpp->size, \
|
||||
"%*s", 8, "N/A"); \
|
||||
slsmg_printf("%s", hpp->buf); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
return __hpp__fmt(hpp, he, __hpp_get_acc_##_field, " %6.2f%%", \
|
||||
__hpp__slsmg_color_printf, true); \
|
||||
return __hpp__fmt(hpp, he, __hpp_get_acc_##_field, " %*.2f%%", \
|
||||
6, __hpp__slsmg_color_printf, true); \
|
||||
}
|
||||
|
||||
__HPP_COLOR_PERCENT_FN(overhead, period)
|
||||
|
Reference in New Issue
Block a user