summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/util.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-19 13:15:24 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-19 13:15:24 -0300
commit61e04b332e9417720c331eb39c96a4ccb1aa0460 (patch)
treeb9968045de00bef1a6e8770a1d2053e1509a42be /tools/perf/util/util.c
parentb793a40185b246c2690e06c6d86d12c35f24ab4c (diff)
downloadblackbird-op-linux-61e04b332e9417720c331eb39c96a4ccb1aa0460.tar.gz
blackbird-op-linux-61e04b332e9417720c331eb39c96a4ccb1aa0460.zip
perf annotate browser: Align jump labels
Find out at browser startup the max width and use it when rendering jump labels on the screen. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-7dxjiwqb77wz6f5lc05e0i0x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r--tools/perf/util/util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 8109a907841e..d03599fbe78b 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -148,3 +148,13 @@ int readn(int fd, void *buf, size_t n)
return buf - buf_start;
}
+
+size_t hex_width(u64 v)
+{
+ size_t n = 1;
+
+ while ((v >>= 4))
+ ++n;
+
+ return n;
+}
OpenPOWER on IntegriCloud