aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-12 14:23:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-13 09:00:05 -0400
commit43c4023152a9c5742948ac919e58ade127fa4e2e (patch)
tree44d76680f97000dad1c804379e71d2479e40b6e8 /tools
parent7b366142a50ad79e48de8e67c5b3e8cfb9fa82dd (diff)
perf annotate: Allow setting the offset level in .perfconfig
The default is 1 (jump_target): # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574 _raw_spin_lock_irqsave() /proc/kcore 0.26 nop 4.61 push %rbx 19.33 pushfq 7.97 pop %rax 0.32 nop 0.06 mov %rax,%rbx 14.63 cli 0.06 nop xor %eax,%eax mov $0x1,%edx 49.94 lock cmpxchg %edx,(%rdi) 0.16 test %eax,%eax ↓ jne 2b 2.66 mov %rbx,%rax pop %rbx ← retq 2b: mov %eax,%esi → callq *ffffffffb30eaed0 mov %rbx,%rax pop %rbx ← retq # But one can ask for showing offsets for call instructions by setting this: # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574 _raw_spin_lock_irqsave() /proc/kcore 0.26 nop 4.61 push %rbx 19.33 pushfq 7.97 pop %rax 0.32 nop 0.06 mov %rax,%rbx 14.63 cli 0.06 nop xor %eax,%eax mov $0x1,%edx 49.94 lock cmpxchg %edx,(%rdi) 0.16 test %eax,%eax ↓ jne 2b 2.66 mov %rbx,%rax pop %rbx ← retq 2b: mov %eax,%esi 2d: → callq *ffffffffb30eaed0 mov %rbx,%rax pop %rbx ← retq # Or using a big value to ask for all offsets to be shown: # cat ~/.perfconfig [annotate] offset_level = 100 hide_src_code = true # perf annotate --ignore-vmlinux --stdio2 _raw_spin_lock_irqsave Samples: 3K of event 'cycles:ppp', 3000 Hz, Event count (approx.): 2766398574 _raw_spin_lock_irqsave() /proc/kcore 0.26 0: nop 4.61 5: push %rbx 19.33 6: pushfq 7.97 7: pop %rax 0.32 8: nop 0.06 d: mov %rax,%rbx 14.63 10: cli 0.06 11: nop 17: xor %eax,%eax 19: mov $0x1,%edx 49.94 1e: lock cmpxchg %edx,(%rdi) 0.16 22: test %eax,%eax 24: ↓ jne 2b 2.66 26: mov %rbx,%rax 29: pop %rbx 2a: ← retq 2b: mov %eax,%esi 2d: → callq *ffffffffb30eaed0 32: mov %rbx,%rax 35: pop %rbx 36: ← retq # This also affects the TUI, i.e. the default 'perf annotate' and 'perf top/report' -> A hotkey -> annotate interfaces, when slang-devel is present in the build, i.e.: # perf version --build-options | grep slang libslang: [ on ] # HAVE_SLANG_SUPPORT # Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Martin Liška <mliska@suse.cz> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> Cc: Thomas Richter <tmricht@linux.vnet.ibm.com> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-venm6x5zrt40eu8hxdsmqxz6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-config.txt5
-rw-r--r--tools/perf/util/annotate.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 5b4fff3adc4b..32f4a898e3f2 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -334,6 +334,11 @@ annotate.*::
334 334
335 99.93 │ mov %eax,%eax 335 99.93 │ mov %eax,%eax
336 336
337 annotate.offset_level::
338 Default is '1', meaning just jump targets will have offsets show right beside
339 the instruction. When set to '2' 'call' instructions will also have its offsets
340 shown, 3 or higher will show offsets for all instructions.
341
337hist.*:: 342hist.*::
338 hist.percentage:: 343 hist.percentage::
339 This option control the way to calculate overhead of filtered entries - 344 This option control the way to calculate overhead of filtered entries -
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 5edc565d86c4..536ee148bff8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2649,10 +2649,11 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,
2649 */ 2649 */
2650static struct annotation_config { 2650static struct annotation_config {
2651 const char *name; 2651 const char *name;
2652 bool *value; 2652 void *value;
2653} annotation__configs[] = { 2653} annotation__configs[] = {
2654 ANNOTATION__CFG(hide_src_code), 2654 ANNOTATION__CFG(hide_src_code),
2655 ANNOTATION__CFG(jump_arrows), 2655 ANNOTATION__CFG(jump_arrows),
2656 ANNOTATION__CFG(offset_level),
2656 ANNOTATION__CFG(show_linenr), 2657 ANNOTATION__CFG(show_linenr),
2657 ANNOTATION__CFG(show_nr_jumps), 2658 ANNOTATION__CFG(show_nr_jumps),
2658 ANNOTATION__CFG(show_nr_samples), 2659 ANNOTATION__CFG(show_nr_samples),
@@ -2684,8 +2685,16 @@ static int annotation__config(const char *var, const char *value,
2684 2685
2685 if (cfg == NULL) 2686 if (cfg == NULL)
2686 pr_debug("%s variable unknown, ignoring...", var); 2687 pr_debug("%s variable unknown, ignoring...", var);
2687 else 2688 else if (strcmp(var, "annotate.offset_level") == 0) {
2688 *cfg->value = perf_config_bool(name, value); 2689 perf_config_int(cfg->value, name, value);
2690
2691 if (*(int *)cfg->value > ANNOTATION__MAX_OFFSET_LEVEL)
2692 *(int *)cfg->value = ANNOTATION__MAX_OFFSET_LEVEL;
2693 else if (*(int *)cfg->value < ANNOTATION__MIN_OFFSET_LEVEL)
2694 *(int *)cfg->value = ANNOTATION__MIN_OFFSET_LEVEL;
2695 } else {
2696 *(bool *)cfg->value = perf_config_bool(name, value);
2697 }
2689 return 0; 2698 return 0;
2690} 2699}
2691 2700