summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browsers
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-18 14:37:34 -0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-18 17:03:08 -0200
commitf1cf602c16e9a93fd16705621f3430ec7ffe2c44 (patch)
tree3f31d1a6fdca87b11375245efcb79c139f0c4733 /tools/perf/util/ui/browsers
parentc172f7422c03463a7177e268ffe625c41c42c179 (diff)
downloadblackbird-op-linux-f1cf602c16e9a93fd16705621f3430ec7ffe2c44.tar.gz
blackbird-op-linux-f1cf602c16e9a93fd16705621f3430ec7ffe2c44.zip
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 <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-jpgy42438ce9tgbqppm397lq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/browsers')
-rw-r--r--tools/perf/util/ui/browsers/hists.c7
1 files changed, 4 insertions, 3 deletions
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;
OpenPOWER on IntegriCloud