diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 12:15:24 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 12:15:24 -0400 |
commit | 61e04b332e9417720c331eb39c96a4ccb1aa0460 (patch) | |
tree | b9968045de00bef1a6e8770a1d2053e1509a42be /tools/perf/util/util.c | |
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/util.c')
-rw-r--r-- | tools/perf/util/util.c | 10 |
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) | |||
148 | 148 | ||
149 | return buf - buf_start; | 149 | return buf - buf_start; |
150 | } | 150 | } |
151 | |||
152 | size_t hex_width(u64 v) | ||
153 | { | ||
154 | size_t n = 1; | ||
155 | |||
156 | while ((v >>= 4)) | ||
157 | ++n; | ||
158 | |||
159 | return n; | ||
160 | } | ||