Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Add ability to sample call branches

This patch add a new branch type sampling filter to perf record.
It is named 'call' and maps to PERF_SAMPLE_BRANCH_CALL. It samples
direct call branches only, unlike 'any_call' which includes indirect
calls as well.

$ perf record -j call -e cycles .....

The man page is updated accordingly.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: khandual@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1444720151-10275-5-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Stephane Eranian and committed by
Ingo Molnar
43e41adc 24f1a79a

+2
+1
tools/perf/Documentation/perf-record.txt
··· 236 236 - any_call: any function call or system call 237 237 - any_ret: any function return or system call return 238 238 - ind_call: any indirect branch 239 + - call: direct calls, including far (to/from kernel) calls 239 240 - u: only when the branch target is at the user level 240 241 - k: only when the branch target is in the kernel 241 242 - hv: only when the target is at the hypervisor level
+1
tools/perf/util/parse-branch-options.c
··· 27 27 BRANCH_OPT("no_tx", PERF_SAMPLE_BRANCH_NO_TX), 28 28 BRANCH_OPT("cond", PERF_SAMPLE_BRANCH_COND), 29 29 BRANCH_OPT("ind_jmp", PERF_SAMPLE_BRANCH_IND_JUMP), 30 + BRANCH_OPT("call", PERF_SAMPLE_BRANCH_CALL), 30 31 BRANCH_END 31 32 }; 32 33