提交 53805eca 编写于 作者: M Michael Hudson-Doyle 提交者: Arnaldo Carvalho de Melo

perf tools: Remove cast of non-variadic function to variadic

The 4fb71074 (perf ui/hist: Consolidate hpp helpers) cset introduced
a cast of percent_color_snprintf to a function pointer type with
varargs.  Change percent_color_snprintf to be variadic and remove the
cast.

The symptom of this was all percentages being reported as 0.00% in perf
report --stdio output on the armhf arch.
Signed-off-by: NMichael Hudson-Doyle <michael.hudson@linaro.org>
Acked-by: NNamhyung Kim <namhyung@kernel.org>
Acked-by: NWill Deacon <will.deacon@arm.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/87zjppvw7y.fsf@canonical.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 e8a923cc
...@@ -117,7 +117,7 @@ static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \ ...@@ -117,7 +117,7 @@ static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
struct perf_hpp *hpp, struct hist_entry *he) \ 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, " %6.2f%%", \
(hpp_snprint_fn)percent_color_snprintf, true); \ percent_color_snprintf, true); \
} }
#define __HPP_ENTRY_PERCENT_FN(_type, _field) \ #define __HPP_ENTRY_PERCENT_FN(_type, _field) \
......
...@@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent) ...@@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
return r; return r;
} }
int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent) int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
{ {
const char *color = get_percent_color(percent); va_list args;
double percent;
const char *color;
va_start(args, fmt);
percent = va_arg(args, double);
va_end(args);
color = get_percent_color(percent);
return color_snprintf(bf, size, color, fmt, percent); return color_snprintf(bf, size, color, fmt, percent);
} }
...@@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); ...@@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...); int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent); int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
int percent_color_fprintf(FILE *fp, const char *fmt, double percent); int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
const char *get_percent_color(double percent); const char *get_percent_color(double percent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册