Skip to contentSkip to conversation

perf python: Make twatch.py work with both python2 and python3

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Feb 21, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  d2ed5d2bdc5cd30b44dc52c44c63f08c0a31b845
Gitweb:     https://git.kernel.org/tip/d2ed5d2bdc5cd30b44dc52c44c63f08c0a31b845
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 19 Feb 2018 12:24:13 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 19 Feb 2018 12:28:08 -0300

perf python: Make twatch.py work with both python2 and python3

Will be used to test patches allowing to build perf with python3, so that we make sure that we can build with both versions.

---
 tools/perf/python/twatch.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/python/twatch.py +4 -4
index c235c22..0a29c5c 100755
@@ -42,10 +42,10 @@ def main(context_switch = 0, thread = -1):
 			event = evlist.read_on_cpu(cpu)
 			if not event:
 				continue
-			print "cpu: %2d, pid: %4d, tid: %4d" % (event.sample_cpu,
-								event.sample_pid,
-								event.sample_tid),
-			print event
+			print("cpu: {0}, pid: {1}, tid: {2} {3}".format(event.sample_cpu,
+                                                                        event.sample_pid,
+                                                                        event.sample_tid,
+                                                                        event))
 
 if __name__ == '__main__':
     """