From: Arnaldo Carvalho de Melo
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.26nop
4.61push %rbx
19.33pushfq
7.97pop%rax
0.32nop
0.06mov%rax,%rbx
14.63cli
0.06nop
xor%eax,%eax
mov$0x1,%edx
49.94lock cmpxchg %edx,(%rdi)
0.16test %eax,%eax
↓ jne2b
2.66mov%rbx,%rax
pop%rbx
← retq
2b: mov%eax,%esi
→ callq *b30eaed0
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.26nop
4.61push %rbx
19.33pushfq
7.97pop%rax
0.32nop
0.06mov%rax,%rbx
14.63cli
0.06nop
xor%eax,%eax
mov$0x1,%edx
49.94lock cmpxchg %edx,(%rdi)
0.16test %eax,%eax
↓ jne2b
2.66mov%rbx,%rax
pop%rbx
← retq
2b: mov%eax,%esi
2d: → callq *b30eaed0
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: ↓ jne2b
2.66 26: mov%rbx,%rax
29: pop%rbx
2a: ← retq
2b: mov%eax,%esi
2d: → callq *b30eaed0
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
Cc: Andi Kleen
Cc: David Ahern
Cc: Jin Yao
Cc: Jiri Olsa
Cc: Martin Liška
Cc: Namhyung Kim
Cc: Ravi Bangoria
Cc: Thomas Richter
Cc: Wang Nan
Link: https://lkml.kernel.org/n/tip-venm6x5zrt40eu8hxdsmq...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
---
tools/perf/Documentation/perf-config.txt | 5 +
tools/perf/util/annotate.c | 15 ---
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.*::
99.93 │ mov%eax,%eax
+ annotate.offset_level::
+ Default is '1', meaning just jump targets will have offsets
show right beside
+ the instruction. When set to '2' 'call' instructions will also
have its offsets
+ shown, 3 or higher will show offsets for all instructions.
+
hist.*::
hist.percentage::
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,
*/
static struct annotation_config {
const char *name;
- bool *value;
+ void *value;
} annotation__configs[] = {
ANNOTATION__CFG(hide_src_code),
ANNOTATION__CFG(jump_arrows),
+ ANNOTATION__CFG(offset_level),
ANNOTATION__CFG(show_linenr),
ANNOTATION__CFG(show_nr_jumps),
ANNOTATION__CFG(show_nr_samples),
@@ -2684,8 +2685,16 @@ static int annotation__config(const char *var, const
char *value,
if (cfg == NULL)
pr_debug("%s variable unknown, ignoring...", var);
- else
-