[PATCH 7/8] perf scripts python: Add Python 3 support to stat-cpi.py

From: Jeremy Cline
Date: Tue May 08 2018 - 17:28:41 EST


Support both Python 2 and Python 3 in stat-cpi.py. This should have no
functional change.

Signed-off-by: Jeremy Cline <jeremy@xxxxxxxxxx>
---
tools/perf/scripts/python/stat-cpi.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/stat-cpi.py b/tools/perf/scripts/python/stat-cpi.py
index 8410672efb8b..fc53a03da412 100644
--- a/tools/perf/scripts/python/stat-cpi.py
+++ b/tools/perf/scripts/python/stat-cpi.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
# SPDX-License-Identifier: GPL-2.0

+from __future__ import print_function
+
data = {}
times = []
threads = []
@@ -59,7 +61,8 @@ def stat__interval(time):
if ins != 0:
cpi = cyc/float(ins)

- print "%15f: cpu %d, thread %d -> cpi %f (%d/%d)" % (time/(float(1000000000)), cpu, thread, cpi, cyc, ins)
+ print("%15f: cpu %d, thread %d -> cpi %f (%d/%d)" %
+ (time/(float(1000000000)), cpu, thread, cpi, cyc, ins))

def trace_end():
pass
--
2.17.0