aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@linaro.org>2013-10-31 19:47:45 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-01 09:40:51 -0400
commit53805eca3d89b095062c11a6798689bb0af09216 (patch)
treed91df4fa0ec2f36f08d2bfd68ed9abeaeb9020f9 /tools
parente8a923cc1fff6e627f906655ad52ee694ef2f6d7 (diff)
perf tools: Remove cast of non-variadic function to variadic
The 4fb71074a570 (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: Michael Hudson-Doyle <michael.hudson@linaro.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Will 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.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/ui/hist.c2
-rw-r--r--tools/perf/util/color.c11
-rw-r--r--tools/perf/util/color.h2
3 files changed, 11 insertions, 4 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 0a193281eba8..78f4c92e9b73 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -117,7 +117,7 @@ static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \
117 struct perf_hpp *hpp, struct hist_entry *he) \ 117 struct perf_hpp *hpp, struct hist_entry *he) \
118{ \ 118{ \
119 return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \ 119 return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \
120 (hpp_snprint_fn)percent_color_snprintf, true); \ 120 percent_color_snprintf, true); \
121} 121}
122 122
123#define __HPP_ENTRY_PERCENT_FN(_type, _field) \ 123#define __HPP_ENTRY_PERCENT_FN(_type, _field) \
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 11e46da17bbb..66e44a5019d5 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
318 return r; 318 return r;
319} 319}
320 320
321int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent) 321int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
322{ 322{
323 const char *color = get_percent_color(percent); 323 va_list args;
324 double percent;
325 const char *color;
326
327 va_start(args, fmt);
328 percent = va_arg(args, double);
329 va_end(args);
330 color = get_percent_color(percent);
324 return color_snprintf(bf, size, color, fmt, percent); 331 return color_snprintf(bf, size, color, fmt, percent);
325} 332}
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
index dea082b79602..fced3840e99c 100644
--- a/tools/perf/util/color.h
+++ b/tools/perf/util/color.h
@@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
39int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...); 39int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
40int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); 40int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
41int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); 41int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
42int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent); 42int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
43int percent_color_fprintf(FILE *fp, const char *fmt, double percent); 43int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
44const char *get_percent_color(double percent); 44const char *get_percent_color(double percent);
45 45