From: Arnaldo Carvalho de Melo Date: Mon, 19 Feb 2018 15:24:13 +0000 (-0300) Subject: perf python: Make twatch.py work with both python2 and python3 X-Git-Tag: v4.17-rc1~179^2~42^2~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=d2ed5d2bdc5cd30b44dc52c44c63f08c0a31b845;p=linux.git 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. Cc: Adrian Hunter Cc: David Ahern Cc: Jaroslav Škarvada Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-c2ynv0ozr3eifzsyit6qgh3h@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/python/twatch.py b/tools/perf/python/twatch.py index c235c22b107a..0a29c5c3079f 100755 --- a/tools/perf/python/twatch.py +++ b/tools/perf/python/twatch.py @@ -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__': """