aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-04 15:05:17 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-08 15:55:52 -0300
commit3e0d79531984c731951d9a8a5be406df3a78ac97 (patch)
treefa59f2526204c5dc498f8e7356a7f7c1d7b75b79 /tools/perf/util/annotate.h
parentperf annotate: Pass browser percent_type in annotate_browser__calc_percent() (diff)
downloadlinux-dev-3e0d79531984c731951d9a8a5be406df3a78ac97.tar.xz
linux-dev-3e0d79531984c731951d9a8a5be406df3a78ac97.zip
perf annotate: Add support to toggle percent type
Add new key bindings to toggle percent type/base in annotation UI browser: 'p' to switch between local and global percent type 'b' to switch between hits and perdio percent base Add the following help messages to the UI browser '?' window: ... p Toggle percent type [local/global] b Toggle percent base [period/hits] ... Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20180804130521.11408-17-jolsa@kernel.org [ Moved percent_type to be the last arg to sym_title(), its an arg to what is being formmated (buf, size) ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r--tools/perf/util/annotate.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 3d4579e68d28..760a6678edff 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -11,6 +11,7 @@
#include <linux/list.h>
#include <linux/rbtree.h>
#include <pthread.h>
+#include <asm/bug.h>
struct ins_ops;
@@ -149,6 +150,21 @@ static inline double annotation_data__percent(struct annotation_data *data,
return which < PERCENT_MAX ? data->percent[which] : -1;
}
+static inline const char *percent_type_str(unsigned int type)
+{
+ static const char *str[PERCENT_MAX] = {
+ "local hits",
+ "global hits",
+ "local period",
+ "global period",
+ };
+
+ if (WARN_ON(type >= PERCENT_MAX))
+ return "N/A";
+
+ return str[type];
+}
+
static inline struct disasm_line *disasm_line(struct annotation_line *al)
{
return al ? container_of(al, struct disasm_line, al) : NULL;