]> git.baikalelectronics.ru Git - kernel.git/commit
perf scripts python: intel-pt-events.py: Print ptwrite value as a string if it is...
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 9 May 2022 15:24:00 +0000 (18:24 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 17 May 2022 14:56:15 +0000 (11:56 -0300)
commit29a0b1453f5c848180264e27f9c89aa8ad8fb409
tree265da4ea3c0eec09f81ad2a3332c5135825d1d2b
parentca2eac39f9cc0847efa3cb68d054825758a497c0
perf scripts python: intel-pt-events.py: Print ptwrite value as a string if it is ASCII

It can be convenient to put a string value into a ptwrite payload as
a quick and easy way to identify what is being printed.

To make that useful, if the Intel ptwrite payload value contains only
printable ASCII characters padded with NULLs, then print it also as a
string.

Using the example program from the "Emulated PTWRITE" section of
tools/perf/Documentation/perf-intel-pt.txt:

 $ echo -n "Hello" | od -t x8
 0000000 0000006f6c6c6548
 0000005
 $ perf record -e intel_pt//u ./eg_ptw 0x0000006f6c6c6548
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.016 MB perf.data ]
 $ perf script --itrace=ew intel-pt-events.py
 Intel PT Branch Trace, Power Events, Event Trace and PTWRITE
      Switch In   38524/38524 [001]     24166.044995916     0/0
           eg_ptw 38524/38524 [001]     24166.045380004   ptwrite  jmp                   IP: 0 payload: 0x6f6c6c6548 Hello     56532c7ce196 perf_emulate_ptwrite+0x16 (/home/ahunter/git/work/eg_ptw)
 End

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220509152400.376613-4-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/scripts/python/intel-pt-events.py