Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py

From: Jiri Olsa
Date: Thu Jan 17 2019 - 07:32:08 EST


On Thu, Jan 17, 2019 at 03:15:28PM +0530, Seeteena Thoufeek wrote:
> Support both Python 2 and Python 3 in check-perf-trace.py.
> ``print`` is now a function rather than a statement. This should have
> no functional change.
>
> Fix indentation issue, replace spaces with tab
>
> Signed-off-by: Seeteena Thoufeek <s1seetee@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx>

hum, could you please add some info about testing those changes?
(or even some global into 0/.. patch)

this is working for me on python2:

[root@krava perf]# perf script rec check-perf-trace
^C
[root@krava perf]# perf script -s scripts/python/check-perf-trace.py
trace_begin

unhandled events:


event count

---------------------------------------- -----------

raw_syscalls__sys_enter 3509879


but fails for python3:

[root@ibm-x3650m4-01-vm-04 perf]# perf script rec check-perf-trace
^C[ perf record: Woken up 0 times to write data ]
Warning:
1 out of order events recorded.
[ perf record: Captured and wrote 43.132 MB perf.data (490171 samples) ]

[root@ibm-x3650m4-01-vm-04 perf]# perf script -s scripts/python/check-perf-trace.py
Traceback (most recent call last):
File "scripts/python/check-perf-trace.py", line 18, in <module>
from perf_trace_context import *
ModuleNotFoundError: No module named 'perf_trace_context'
Error running python script scripts/python/check-perf-trace.py

I did not test with rpm, just did 'make install' for perf

thanks,
jirka