From f1cf602c16e9a93fd16705621f3430ec7ffe2c44 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 18 Oct 2011 14:37:34 -0200 Subject: perf hists: Don't format the percentage on hist_entry__snprintf We can't have color correctly set there because in libslang (and in a future GUI) the colors must be set on a separate function call, so move that part to a separate function and make the stdio fprintf function call it. Cc: David Ahern Cc: Frederic Weisbecker Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-jpgy42438ce9tgbqppm397lq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/ui/browsers/hists.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/perf/util/ui/browsers/hists.c') diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 2d390b9cb63e..0eced19e3bdb 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c @@ -547,7 +547,7 @@ static int hist_browser__show_entry(struct hist_browser *self, char s[256]; double percent; int printed = 0; - int width = self->b.width; + int width = self->b.width - 6; /* The percentage */ char folded_sign = ' '; bool current_entry = ui_browser__is_current_entry(&self->b, row); off_t row_offset = entry->row_offset; @@ -563,8 +563,7 @@ static int hist_browser__show_entry(struct hist_browser *self, } if (row_offset == 0) { - hist_entry__snprintf(entry, s, sizeof(s), self->hists, NULL, false, - 0, false, self->hists->stats.total_period); + hist_entry__snprintf(entry, s, sizeof(s), self->hists); percent = (entry->period * 100.0) / self->hists->stats.total_period; ui_browser__set_percent_color(&self->b, percent, current_entry); @@ -574,6 +573,8 @@ static int hist_browser__show_entry(struct hist_browser *self, width -= 2; } + slsmg_printf(" %5.2f%%", percent); + /* The scroll bar isn't being used */ if (!self->b.navkeypressed) width += 1; -- cgit v1.2.3