* [PATCH] perf tools/perf/python/tracepoint.py: Converted to Python3
@ 2022-03-28 6:08 Tanu M
2022-03-30 20:39 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Tanu M @ 2022-03-28 6:08 UTC (permalink / raw)
To: linux-perf-users; +Cc: mingo, acme, peterz
Hi,
I have converted the tracepoint.py file to python3 as many of the
files in tools/perf are already written in python3.
Signed-off-by: Tanusree Debnath <tanu235m@gmail.com>
---
tools/perf/python/tracepoint.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py
index 461848c7f..6a63e6c41 100755
--- a/tools/perf/python/tracepoint.py
+++ b/tools/perf/python/tracepoint.py
@@ -34,7 +34,7 @@ def main():
if not isinstance(event, perf.sample_event):
continue
- print "time %u prev_comm=%s prev_pid=%d prev_prio=%d
prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
+ print ("time %u prev_comm=%s prev_pid=%d prev_prio=%d
prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
event.sample_time,
event.prev_comm,
event.prev_pid,
@@ -42,7 +42,7 @@ def main():
event.prev_state,
event.next_comm,
event.next_pid,
- event.next_prio)
+ event.next_prio))
if __name__ == '__main__':
main()
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools/perf/python/tracepoint.py: Converted to Python3
2022-03-28 6:08 [PATCH] perf tools/perf/python/tracepoint.py: Converted to Python3 Tanu M
@ 2022-03-30 20:39 ` Arnaldo Carvalho de Melo
2022-03-30 20:47 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-03-30 20:39 UTC (permalink / raw)
To: Tanu M; +Cc: linux-perf-users, mingo, peterz
Em Sun, Mar 27, 2022 at 11:08:46PM -0700, Tanu M escreveu:
> Hi,
> I have converted the tracepoint.py file to python3 as many of the
> files in tools/perf are already written in python3.
>
> Signed-off-by: Tanusree Debnath <tanu235m@gmail.com>
Got this:
⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
patching file tools/perf/python/tracepoint.py
patch: **** malformed patch at line 119: prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
⬢[acme@toolbox perf]$
I'll apply it by hand, please check your e-mail client.
- Arnaldo
> ---
> tools/perf/python/tracepoint.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py
> index 461848c7f..6a63e6c41 100755
> --- a/tools/perf/python/tracepoint.py
> +++ b/tools/perf/python/tracepoint.py
> @@ -34,7 +34,7 @@ def main():
> if not isinstance(event, perf.sample_event):
> continue
>
> - print "time %u prev_comm=%s prev_pid=%d prev_prio=%d
> prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
> + print ("time %u prev_comm=%s prev_pid=%d prev_prio=%d
> prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
> event.sample_time,
> event.prev_comm,
> event.prev_pid,
> @@ -42,7 +42,7 @@ def main():
> event.prev_state,
> event.next_comm,
> event.next_pid,
> - event.next_prio)
> + event.next_prio))
>
> if __name__ == '__main__':
> main()
> --
> 2.25.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf tools/perf/python/tracepoint.py: Converted to Python3
2022-03-30 20:39 ` Arnaldo Carvalho de Melo
@ 2022-03-30 20:47 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-03-30 20:47 UTC (permalink / raw)
To: Tanu M
Cc: linux-perf-users, Jiri Olsa, Linux Kernel Mailing List, mingo,
peterz
Em Wed, Mar 30, 2022 at 05:39:07PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sun, Mar 27, 2022 at 11:08:46PM -0700, Tanu M escreveu:
> > Hi,
> > I have converted the tracepoint.py file to python3 as many of the
> > files in tools/perf are already written in python3.
> >
> > Signed-off-by: Tanusree Debnath <tanu235m@gmail.com>
>
> Got this:
>
> ⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
> patching file tools/perf/python/tracepoint.py
> patch: **** malformed patch at line 119: prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
>
> ⬢[acme@toolbox perf]$
>
> I'll apply it by hand, please check your e-mail client.
you forgot to add the author of that example to the Cc list, done, here
is how it ended up:
commit e2774e6d25c12478d43e47e5d268aee6441a8479
Author: Tanu M <tanu235m@gmail.com>
Date: Sun Mar 27 23:08:46 2022 -0700
perf python: Convert tracepoint.py example to python3
Convert the tracepoint.py file to python3 as many of the files in
tools/perf are already written in python3.
Committer testing:
# export PYTHONPATH=/tmp/build/perf/python/
# python3 ~acme/git/perf/tools/perf/python/tracepoint.py | head
time 67394457376909 prev_comm=swapper/12 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=gnome-terminal- next_pid=3313 next_prio=120
time 67394457807669 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
time 67394457811859 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
time 67394457824929 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
time 67394457831899 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
time 67394457842299 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
time 67394457844179 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
time 67394457853879 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
time 67394457856339 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
time 67394457865659 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
Traceback (most recent call last):
File "/var/home/acme/git/perf/tools/perf/python/tracepoint.py", line 48, in <module>
main()
File "/var/home/acme/git/perf/tools/perf/python/tracepoint.py", line 37, in main
print("time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
BrokenPipeError: [Errno 32] Broken pipe
#
Signed-off-by: Tanu M <tanu235m@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/linux-perf-users/CAPS78prawYzRZnyhWjgOnGw4EwoswNwztvfZFdCOPOydFzVwzQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py
index 461848c7f57dca3d..bba68a6d45156183 100755
--- a/tools/perf/python/tracepoint.py
+++ b/tools/perf/python/tracepoint.py
@@ -34,7 +34,7 @@ def main():
if not isinstance(event, perf.sample_event):
continue
- print "time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
+ print("time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
event.sample_time,
event.prev_comm,
event.prev_pid,
@@ -42,7 +42,7 @@ def main():
event.prev_state,
event.next_comm,
event.next_pid,
- event.next_prio)
+ event.next_prio))
if __name__ == '__main__':
main()
- Arnaldo
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-30 20:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-28 6:08 [PATCH] perf tools/perf/python/tracepoint.py: Converted to Python3 Tanu M
2022-03-30 20:39 ` Arnaldo Carvalho de Melo
2022-03-30 20:47 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).