diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 13:15:24 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 13:15:24 -0300 |
commit | 61e04b332e9417720c331eb39c96a4ccb1aa0460 (patch) | |
tree | b9968045de00bef1a6e8770a1d2053e1509a42be /tools/perf/util | |
parent | b793a40185b246c2690e06c6d86d12c35f24ab4c (diff) |
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')
-rw-r--r-- | tools/perf/util/util.c | 10 | ||||
-rw-r--r-- | tools/perf/util/util.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 8109a907841..d03599fbe78 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; +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 0f99f394d8e..6121e24fefc 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -265,4 +265,6 @@ bool is_power_of_2(unsigned long n) return (n != 0 && ((n & (n - 1)) == 0)); } +size_t hex_width(u64 v); + #endif |