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

perf script: Add option --show-text-poke-events

Consistent with other new events, add an option to perf script to
display text poke events and ksymbol events. Both text poke events and
ksymbol events are displayed because some text pokes (e.g. ftrace
trampolines) have corresponding ksymbol events.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: x86@kernel.org
Link: http://lore.kernel.org/lkml/20200512121922.8997-15-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
92ecf3a6 b22f90aa

+23
+4
tools/perf/Documentation/perf-script.txt
··· 322 322 --show-cgroup-events 323 323 Display cgroup events i.e. events of type PERF_RECORD_CGROUP. 324 324 325 + --show-text-poke-events 326 + Display text poke events i.e. events of type PERF_RECORD_TEXT_POKE and 327 + PERF_RECORD_KSYMBOL. 328 + 325 329 --demangle:: 326 330 Demangle symbol names to human readable form. It's enabled by default, 327 331 disable with --no-demangle.
+19
tools/perf/builtin-script.c
··· 1678 1678 bool show_round_events; 1679 1679 bool show_bpf_events; 1680 1680 bool show_cgroup_events; 1681 + bool show_text_poke_events; 1681 1682 bool allocated; 1682 1683 bool per_event_dump; 1683 1684 bool stitch_lbr; ··· 2330 2329 sample->tid); 2331 2330 } 2332 2331 2332 + static int process_text_poke_events(struct perf_tool *tool, 2333 + union perf_event *event, 2334 + struct perf_sample *sample, 2335 + struct machine *machine) 2336 + { 2337 + if (perf_event__process_text_poke(tool, event, sample, machine) < 0) 2338 + return -1; 2339 + 2340 + return print_event(tool, event, sample, machine, sample->pid, 2341 + sample->tid); 2342 + } 2343 + 2333 2344 static void sig_handler(int sig __maybe_unused) 2334 2345 { 2335 2346 session_done = 1; ··· 2449 2436 if (script->show_bpf_events) { 2450 2437 script->tool.ksymbol = process_bpf_events; 2451 2438 script->tool.bpf = process_bpf_events; 2439 + } 2440 + if (script->show_text_poke_events) { 2441 + script->tool.ksymbol = process_bpf_events; 2442 + script->tool.text_poke = process_text_poke_events; 2452 2443 } 2453 2444 2454 2445 if (perf_script__setup_per_event_dump(script)) { ··· 3490 3473 "Show round events (if recorded)"), 3491 3474 OPT_BOOLEAN('\0', "show-bpf-events", &script.show_bpf_events, 3492 3475 "Show bpf related events (if recorded)"), 3476 + OPT_BOOLEAN('\0', "show-text-poke-events", &script.show_text_poke_events, 3477 + "Show text poke related events (if recorded)"), 3493 3478 OPT_BOOLEAN('\0', "per-event-dump", &script.per_event_dump, 3494 3479 "Dump trace output to files named by the monitored events"), 3495 3480 OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),