linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
@ 2019-01-17  9:45 Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to event_analyzing_sample.py Seeteena Thoufeek
                   ` (17 more replies)
  0 siblings, 18 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

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@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/check-perf-trace.py | 33 ++++++++++++++-------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
index 334599c..91fc499 100644
--- a/tools/perf/scripts/python/check-perf-trace.py
+++ b/tools/perf/scripts/python/check-perf-trace.py
@@ -7,6 +7,7 @@
 # events, etc.  Basically, if this script runs successfully and
 # displays expected results, Python scripting support should be ok.
 
+from __future__ import print_function
 import os
 import sys
 
@@ -19,7 +20,7 @@ from perf_trace_context import *
 unhandled = autodict()
 
 def trace_begin():
-	print "trace_begin"
+	print("trace_begin")
 	pass
 
 def trace_end():
@@ -31,10 +32,10 @@ def irq__softirq_entry(event_name, context, common_cpu,
 		print_header(event_name, common_cpu, common_secs, common_nsecs,
 			common_pid, common_comm)
 
-                print_uncommon(context)
+		print_uncommon(context)
 
-		print "vec=%s\n" % \
-		(symbol_str("irq__softirq_entry", "vec", vec)),
+		print("vec=%s\n" % \
+		(symbol_str("irq__softirq_entry", "vec", vec))),
 
 def kmem__kmalloc(event_name, context, common_cpu,
 	common_secs, common_nsecs, common_pid, common_comm,
@@ -43,13 +44,13 @@ def kmem__kmalloc(event_name, context, common_cpu,
 		print_header(event_name, common_cpu, common_secs, common_nsecs,
 			common_pid, common_comm)
 
-                print_uncommon(context)
+		print_uncommon(context)
 
-		print "call_site=%u, ptr=%u, bytes_req=%u, " \
+		print("call_site=%u, ptr=%u, bytes_req=%u, " \
 		"bytes_alloc=%u, gfp_flags=%s\n" % \
 		(call_site, ptr, bytes_req, bytes_alloc,
 
-		flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
+		flag_str("kmem__kmalloc", "gfp_flags", gfp_flags))),
 
 def trace_unhandled(event_name, context, event_fields_dict):
     try:
@@ -58,25 +59,25 @@ def trace_unhandled(event_name, context, event_fields_dict):
         unhandled[event_name] = 1
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
-	print "%-20s %5u %05u.%09u %8u %-20s " % \
-	(event_name, cpu, secs, nsecs, pid, comm),
+	print("%-20s %5u %05u.%09u %8u %-20s " % \
+	(event_name, cpu, secs, nsecs, pid, comm)),
 
 # print trace fields not included in handler args
 def print_uncommon(context):
-    print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
+    print("common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
         % (common_pc(context), trace_flag_str(common_flags(context)), \
-               common_lock_depth(context))
+               common_lock_depth(context)))
 
 def print_unhandled():
     keys = unhandled.keys()
     if not keys:
         return
 
-    print "\nunhandled events:\n\n",
+    print("\nunhandled events:\n\n"),
 
-    print "%-40s  %10s\n" % ("event", "count"),
-    print "%-40s  %10s\n" % ("----------------------------------------", \
-                                 "-----------"),
+    print("%-40s  %10s\n" % ("event", "count")),
+    print("%-40s  %10s\n" % ("----------------------------------------", \
+                                 "-----------")),
 
     for event_name in keys:
-	print "%-40s  %10d\n" % (event_name, unhandled[event_name])
+        print("%-40s  %10d\n" % (event_name, unhandled[event_name]))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to event_analyzing_sample.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py Seeteena Thoufeek
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in event_analyzing_sample.py. ``print``
is now a function rather than a statement. This should have no functional
change.

Fixes indentation issue, replace spaces with tab. The "has_key()" method
is deprecated in favor of the "in" operator. So incorporate those changes
here.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 .../perf/scripts/python/event_analyzing_sample.py  | 57 +++++++++++-----------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/tools/perf/scripts/python/event_analyzing_sample.py b/tools/perf/scripts/python/event_analyzing_sample.py
index 4e843b9..4ae239d 100644
--- a/tools/perf/scripts/python/event_analyzing_sample.py
+++ b/tools/perf/scripts/python/event_analyzing_sample.py
@@ -14,6 +14,7 @@
 # generic events with the help of sqlite, and the 2nd one "show_pebs_ll" is
 # for a x86 HW PMU event: PEBS with load latency data.
 #
+from __future__ import print_function
 
 import os
 import sys
@@ -37,20 +38,20 @@ con = sqlite3.connect("/dev/shm/perf.db")
 con.isolation_level = None
 
 def trace_begin():
-	print "In trace_begin:\n"
+	print("In trace_begin:\n")
 
         #
         # Will create several tables at the start, pebs_ll is for PEBS data with
         # load latency info, while gen_events is for general event.
         #
-        con.execute("""
+	con.execute("""
                 create table if not exists gen_events (
                         name text,
                         symbol text,
                         comm text,
                         dso text
                 );""")
-        con.execute("""
+	con.execute("""
                 create table if not exists pebs_ll (
                         name text,
                         symbol text,
@@ -76,12 +77,12 @@ def process_event(param_dict):
         name       = param_dict["ev_name"]
 
         # Symbol and dso info are not always resolved
-        if (param_dict.has_key("dso")):
+        if ('dso' in param_dict):
                 dso = param_dict["dso"]
         else:
                 dso = "Unknown_dso"
 
-        if (param_dict.has_key("symbol")):
+        if ('symbol' in param_dict):
                 symbol = param_dict["symbol"]
         else:
                 symbol = "Unknown_symbol"
@@ -102,11 +103,11 @@ def insert_db(event):
                                 event.ip, event.status, event.dse, event.dla, event.lat))
 
 def trace_end():
-	print "In trace_end:\n"
+	print("In trace_end:\n")
         # We show the basic info for the 2 type of event classes
-        show_general_events()
-        show_pebs_ll()
-        con.close()
+	show_general_events()
+	show_pebs_ll()
+	con.close()
 
 #
 # As the event number may be very big, so we can't use linear way
@@ -123,29 +124,29 @@ def show_general_events():
         # Check the total record number in the table
         count = con.execute("select count(*) from gen_events")
         for t in count:
-                print "There is %d records in gen_events table" % t[0]
+                print("There is %d records in gen_events table" % t[0])
                 if t[0] == 0:
                         return
 
-        print "Statistics about the general events grouped by thread/symbol/dso: \n"
+        print("Statistics about the general events grouped by thread/symbol/dso: \n")
 
          # Group by thread
         commq = con.execute("select comm, count(comm) from gen_events group by comm order by -count(comm)")
-        print "\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42)
+        print("\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42))
         for row in commq:
-             print "%16s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%16s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by symbol
-        print "\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58))
         symbolq = con.execute("select symbol, count(symbol) from gen_events group by symbol order by -count(symbol)")
         for row in symbolq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by dso
-        print "\n%40s %8s %16s\n%s" % ("dso", "number", "histogram", "="*74)
+        print("\n%40s %8s %16s\n%s" % ("dso", "number", "histogram", "="*74))
         dsoq = con.execute("select dso, count(dso) from gen_events group by dso order by -count(dso)")
         for row in dsoq:
-             print "%40s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%40s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
 #
 # This function just shows the basic info, and we could do more with the
@@ -156,35 +157,35 @@ def show_pebs_ll():
 
         count = con.execute("select count(*) from pebs_ll")
         for t in count:
-                print "There is %d records in pebs_ll table" % t[0]
+                print("There is %d records in pebs_ll table" % t[0])
                 if t[0] == 0:
                         return
 
-        print "Statistics about the PEBS Load Latency events grouped by thread/symbol/dse/latency: \n"
+        print("Statistics about the PEBS Load Latency events grouped by thread/symbol/dse/latency: \n")
 
         # Group by thread
         commq = con.execute("select comm, count(comm) from pebs_ll group by comm order by -count(comm)")
-        print "\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42)
+        print("\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42))
         for row in commq:
-             print "%16s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%16s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by symbol
-        print "\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58))
         symbolq = con.execute("select symbol, count(symbol) from pebs_ll group by symbol order by -count(symbol)")
         for row in symbolq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by dse
         dseq = con.execute("select dse, count(dse) from pebs_ll group by dse order by -count(dse)")
-        print "\n%32s %8s %16s\n%s" % ("dse", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("dse", "number", "histogram", "="*58))
         for row in dseq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by latency
         latq = con.execute("select lat, count(lat) from pebs_ll group by lat order by lat")
-        print "\n%32s %8s %16s\n%s" % ("latency", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("latency", "number", "histogram", "="*58))
         for row in latq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
 def trace_unhandled(event_name, context, event_fields_dict):
-		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
+		print(' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to event_analyzing_sample.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  0:45   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py Seeteena Thoufeek
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in exported-sql-viewer.py.
``print`` is now a function rather than a statement. This should have
no functional change.

Add support of _pickle module in Python3

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/exported-sql-viewer.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index f278ce5..a4aef58 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python2
 # SPDX-License-Identifier: GPL-2.0
 # exported-sql-viewer.py: view data from sql database
 # Copyright (c) 2014-2018, Intel Corporation.
@@ -87,12 +86,12 @@
 #                                                                              7fab593ea94f 48 8b 05 1a 15 22 00                            movq  0x22151a(%rip), %rax
 #                                                                              7fab593ea956 48 89 15 3b 13 22 00                            movq  %rdx, 0x22133b(%rip)
 # 8107675243232  2    ls       22011  22011  hardware interrupt     No         7fab593ea956 _dl_start+0x26 (ld-2.19.so) -> ffffffff86a012e0 page_fault ([kernel])
+from __future__ import print_function
 
 import sys
 import weakref
 import threading
 import string
-import cPickle
 import re
 import os
 from PySide.QtCore import *
@@ -102,6 +101,11 @@ from decimal import *
 from ctypes import *
 from multiprocessing import Process, Array, Value, Event
 
+if sys.version_info[0] < 3:
+    import cPickle
+else:
+    import _pickle as cPickle
+
 # Data formatting helpers
 
 def tohex(ip):
@@ -1560,7 +1564,7 @@ class SQLTableDialogDataItem():
 					return str(lower_id)
 
 	def ConvertRelativeTime(self, val):
-		print "val ", val
+		print("val ", val)
 		mult = 1
 		suffix = val[-2:]
 		if suffix == "ms":
@@ -1582,29 +1586,29 @@ class SQLTableDialogDataItem():
 		return str(val)
 
 	def ConvertTimeRange(self, vrange):
-		print "vrange ", vrange
+		print("vrange ", vrange)
 		if vrange[0] == "":
 			vrange[0] = str(self.first_time)
 		if vrange[1] == "":
 			vrange[1] = str(self.last_time)
 		vrange[0] = self.ConvertRelativeTime(vrange[0])
 		vrange[1] = self.ConvertRelativeTime(vrange[1])
-		print "vrange2 ", vrange
+		print("vrange2 ", vrange)
 		if not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]):
 			return False
-		print "ok1"
+		print("ok1")
 		beg_range = max(int(vrange[0]), self.first_time)
 		end_range = min(int(vrange[1]), self.last_time)
 		if beg_range > self.last_time or end_range < self.first_time:
 			return False
-		print "ok2"
+		print("ok2")
 		vrange[0] = self.BinarySearchTime(0, self.last_id, beg_range, True)
 		vrange[1] = self.BinarySearchTime(1, self.last_id + 1, end_range, False)
-		print "vrange3 ", vrange
+		print("vrange3 ", vrange)
 		return True
 
 	def AddTimeRange(self, value, ranges):
-		print "value ", value
+		print("value ", value)
 		n = value.count("-")
 		if n == 1:
 			pass
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to event_analyzing_sample.py Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:05   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py Seeteena Thoufeek
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in export-to-sqlite.py. ``print`` is
now a function rather than a statement. This should have no functional
change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/export-to-sqlite.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index 245caf2..66be899 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -9,6 +9,7 @@
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 # more details.
+from __future__ import print_function
 
 import os
 import sys
@@ -100,7 +101,7 @@ def do_query_(q):
 		return
 	raise Exception("Query failed: " + q.lastError().text())
 
-print datetime.datetime.today(), "Creating database..."
+print(datetime.datetime.today(), "Creating database...")
 
 db_exists = False
 try:
@@ -376,7 +377,7 @@ if perf_db_export_calls:
 	call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
 
 def trace_begin():
-	print datetime.datetime.today(), "Writing records..."
+	print(datetime.datetime.today(), "Writing records...")
 	do_query(query, 'BEGIN TRANSACTION')
 	# id == 0 means unknown.  It is easier to create records for them than replace the zeroes with NULLs
 	evsel_table(0, "unknown")
@@ -394,13 +395,13 @@ unhandled_count = 0
 def trace_end():
 	do_query(query, 'END TRANSACTION')
 
-	print datetime.datetime.today(), "Adding indexes"
+	print(datetime.datetime.today(), "Adding indexes")
 	if perf_db_export_calls:
 		do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)')
 
 	if (unhandled_count):
-		print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events"
-	print datetime.datetime.today(), "Done"
+		print(datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events")
+	print(datetime.datetime.today(), "Done")
 
 def trace_unhandled(event_name, context, event_fields_dict):
 	global unhandled_count
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (2 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:12   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to futex-contention.py Seeteena Thoufeek
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in failed-syscalls-by-pid.py.
``print`` is now a function rather than a statement. This should have
no functional change.

Fixes lambda syntax error.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

Please enter the commit message for your changes. Lines starting
---
 tools/perf/scripts/python/failed-syscalls-by-pid.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py
index cafeff3..a174755 100644
--- a/tools/perf/scripts/python/failed-syscalls-by-pid.py
+++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py
@@ -4,6 +4,7 @@
 #
 # Displays system-wide failed system call totals, broken down by pid.
 # If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+from __future__ import print_function
 
 import os
 import sys
@@ -32,7 +33,7 @@ if len(sys.argv) > 1:
 syscalls = autodict()
 
 def trace_begin():
-	print "Press control+C to stop and show the summary"
+	print("Press control+C to stop and show the summary")
 
 def trace_end():
 	print_error_totals()
@@ -57,22 +58,22 @@ def syscalls__sys_exit(event_name, context, common_cpu,
 
 def print_error_totals():
     if for_comm is not None:
-	    print "\nsyscall errors for %s:\n\n" % (for_comm),
+	    print("\nsyscall errors for %s:\n\n" % (for_comm)),
     else:
-	    print "\nsyscall errors:\n\n",
+	    print("\nsyscall errors:\n\n"),
 
-    print "%-30s  %10s\n" % ("comm [pid]", "count"),
-    print "%-30s  %10s\n" % ("------------------------------", \
-                                 "----------"),
+    print("%-30s  %10s\n" % ("comm [pid]", "count")),
+    print("%-30s  %10s\n" % ("------------------------------", \
+                                 "----------")),
 
     comm_keys = syscalls.keys()
     for comm in comm_keys:
 	    pid_keys = syscalls[comm].keys()
 	    for pid in pid_keys:
-		    print "\n%s [%d]\n" % (comm, pid),
+		    print("\n%s [%d]\n" % (comm, pid)),
 		    id_keys = syscalls[comm][pid].keys()
 		    for id in id_keys:
-			    print "  syscall: %-16s\n" % syscall_name(id),
+			    print("  syscall: %-16s\n" % syscall_name(id)),
 			    ret_keys = syscalls[comm][pid][id].keys()
-			    for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k),  reverse = True):
-				    print "    err = %-20s  %10d\n" % (strerror(ret), val),
+			    for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda k_v: (k_v[1], k_v[0]),  reverse = True):
+				    print("    err = %-20s  %10d\n" % (strerror(ret), val)),
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to futex-contention.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (3 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py Seeteena Thoufeek
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in futex-contention.py.
``print`` is now a function rather than a statement. This should
have no functional change.

The "has_key()" method is deprecated in favor of the "in" operator.
So incorporate those changes here.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

Please enter the commit message for your changes. Lines starting
---
 tools/perf/scripts/python/futex-contention.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index 0f5cf43..794a9f0 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -9,6 +9,7 @@
 # to perf python scripting.
 #
 # Measures futex contention
+from __future__ import print_function
 
 import os, sys
 sys.path.append(os.environ['PERF_EXEC_PATH'] + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
@@ -33,18 +34,18 @@ def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, callchain,
 
 def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, callchain,
 			     nr, ret):
-	if thread_blocktime.has_key(tid):
+	if (tid in thread_blocktime):
 		elapsed = nsecs(s, ns) - thread_blocktime[tid]
 		add_stats(lock_waits, (tid, thread_thislock[tid]), elapsed)
 		del thread_blocktime[tid]
 		del thread_thislock[tid]
 
 def trace_begin():
-	print "Press control+C to stop and show the summary"
+	print("Press control+C to stop and show the summary")
 
 def trace_end():
 	for (tid, lock) in lock_waits:
 		min, max, avg, count = lock_waits[tid, lock]
-		print "%s[%d] lock %x contended %d times, %d avg ns" % \
-		      (process_names[tid], tid, lock, count, avg)
+		print("%s[%d] lock %x contended %d times, %d avg ns" % \
+		      (process_names[tid], tid, lock, count, avg))
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (4 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to futex-contention.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:16   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to mem-phys-addr.py Seeteena Thoufeek
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in intel-pt-events.py.``print``
is now a function rather than a statement. This should have no
functional change.

Fixes indentation issue, replace spaces with tab.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/intel-pt-events.py | 57 ++++++++++++++--------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
index b19172d..de153f7 100644
--- a/tools/perf/scripts/python/intel-pt-events.py
+++ b/tools/perf/scripts/python/intel-pt-events.py
@@ -9,6 +9,7 @@
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 # more details.
+from __future__ import print_function
 
 import os
 import sys
@@ -22,34 +23,34 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 #from Core import *
 
 def trace_begin():
-	print "Intel PT Power Events and PTWRITE"
+	print("Intel PT Power Events and PTWRITE")
 
 def trace_end():
-	print "End"
+	print("End")
 
 def trace_unhandled(event_name, context, event_fields_dict):
-		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
+		print(' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]))
 
 def print_ptwrite(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
 	flags = data[0]
 	payload = data[1]
 	exact_ip = flags & 1
-	print "IP: %u payload: %#x" % (exact_ip, payload),
+	print("IP: %u payload: %#x" % (exact_ip, payload)),
 
 def print_cbr(raw_buf):
 	data = struct.unpack_from("<BBBBII", raw_buf)
 	cbr = data[0]
 	f = (data[4] + 500) / 1000
 	p = ((cbr * 1000 / data[2]) + 5) / 10
-	print "%3u  freq: %4u MHz  (%3u%%)" % (cbr, f, p),
+	print("%3u  freq: %4u MHz  (%3u%%)" % (cbr, f, p)),
 
 def print_mwait(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
 	payload = data[1]
 	hints = payload & 0xff
 	extensions = (payload >> 32) & 0x3
-	print "hints: %#x extensions: %#x" % (hints, extensions),
+	print("hints: %#x extensions: %#x" % (hints, extensions)),
 
 def print_pwre(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
@@ -57,13 +58,13 @@ def print_pwre(raw_buf):
 	hw = (payload >> 7) & 1
 	cstate = (payload >> 12) & 0xf
 	subcstate = (payload >> 8) & 0xf
-	print "hw: %u cstate: %u sub-cstate: %u" % (hw, cstate, subcstate),
+	print("hw: %u cstate: %u sub-cstate: %u" % (hw, cstate, subcstate)),
 
 def print_exstop(raw_buf):
 	data = struct.unpack_from("<I", raw_buf)
 	flags = data[0]
 	exact_ip = flags & 1
-	print "IP: %u" % (exact_ip),
+	print("IP: %u" % (exact_ip)),
 
 def print_pwrx(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
@@ -71,37 +72,37 @@ def print_pwrx(raw_buf):
 	deepest_cstate = payload & 0xf
 	last_cstate = (payload >> 4) & 0xf
 	wake_reason = (payload >> 8) & 0xf
-	print "deepest cstate: %u last cstate: %u wake reason: %#x" % (deepest_cstate, last_cstate, wake_reason),
+	print("deepest cstate: %u last cstate: %u wake reason: %#x" % (deepest_cstate, last_cstate, wake_reason)),
 
 def print_common_start(comm, sample, name):
 	ts = sample["time"]
 	cpu = sample["cpu"]
 	pid = sample["pid"]
 	tid = sample["tid"]
-	print "%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name),
+	print("%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name)),
 
 def print_common_ip(sample, symbol, dso):
 	ip = sample["ip"]
-	print "%16x %s (%s)" % (ip, symbol, dso)
+	print("%16x %s (%s)" % (ip, symbol, dso))
 
 def process_event(param_dict):
-        event_attr = param_dict["attr"]
-        sample     = param_dict["sample"]
-        raw_buf    = param_dict["raw_buf"]
-        comm       = param_dict["comm"]
-        name       = param_dict["ev_name"]
-
-        # Symbol and dso info are not always resolved
-        if (param_dict.has_key("dso")):
-                dso = param_dict["dso"]
-        else:
-                dso = "[unknown]"
-
-        if (param_dict.has_key("symbol")):
-                symbol = param_dict["symbol"]
-        else:
-                symbol = "[unknown]"
-
+	event_attr = param_dict["attr"]
+	sample     = param_dict["sample"]
+	raw_buf    = param_dict["raw_buf"]
+	comm       = param_dict["comm"]
+	name       = param_dict["ev_name"]
+
+	# Symbol and dso info are not always resolved
+	if ('dso' in param_dict):
+		dso = param_dict["dso"]
+	else:
+		dso = "[unknown]"
+
+	if ('symbol' in param_dict):
+		symbol = param_dict["symbol"]
+	else:
+		symbol = "[unknown]"
+
 	if name == "ptwrite":
 		print_common_start(comm, sample, name)
 		print_ptwrite(raw_buf)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to mem-phys-addr.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (5 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py Seeteena Thoufeek
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in mem-phys-addr.py. ``print`` is now a
function rather than a statement. This should have no functional change.

Fix lambda syntax error.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/mem-phys-addr.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py
index ebee2c5..e30fc9d 100644
--- a/tools/perf/scripts/python/mem-phys-addr.py
+++ b/tools/perf/scripts/python/mem-phys-addr.py
@@ -3,6 +3,7 @@
 #
 # Copyright (c) 2018, Intel Corporation.
 
+from __future__ import print_function
 from __future__ import division
 import os
 import sys
@@ -38,14 +39,14 @@ def parse_iomem():
 			pmem.append(long(m[1], 16))
 
 def print_memory_type():
-	print "Event: %s" % (event_name)
-	print "%-40s  %10s  %10s\n" % ("Memory type", "count", "percentage"),
-	print "%-40s  %10s  %10s\n" % ("----------------------------------------", \
-					"-----------", "-----------"),
+	print("Event: %s" % (event_name))
+	print("%-40s  %10s  %10s\n" % ("Memory type", "count", "percentage")),
+	print("%-40s  %10s  %10s\n" % ("----------------------------------------", \
+					"-----------", "-----------")),
 	total = sum(load_mem_type_cnt.values())
 	for mem_type, count in sorted(load_mem_type_cnt.most_common(), \
-					key = lambda(k, v): (v, k), reverse = True):
-		print "%-40s  %10d  %10.1f%%\n" % (mem_type, count, 100 * count / total),
+					key = lambda k_v: (k_v[1], k_v[0]), reverse = True):
+		print("%-40s  %10d  %10.1f%%\n" % (mem_type, count, 100 * count / total)),
 
 def trace_begin():
 	parse_iomem()
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (6 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to mem-phys-addr.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:21   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to net_dropmonitor.py Seeteena Thoufeek
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in netdev-times.py. ``print``
is now a function rather than a statement. This should have no
functional change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/netdev-times.py | 77 ++++++++++++++++---------------
 1 file changed, 39 insertions(+), 38 deletions(-)

diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py
index 9b2050f..c25965c 100644
--- a/tools/perf/scripts/python/netdev-times.py
+++ b/tools/perf/scripts/python/netdev-times.py
@@ -7,6 +7,7 @@
 # rx: show only rx chart
 # dev=: show only thing related to specified device
 # debug: work with debug mode. It shows buffer status.
+from __future__ import print_function
 
 import os
 import sys
@@ -61,12 +62,12 @@ def diff_msec(src, dst):
 def print_transmit(hunk):
 	if dev != 0 and hunk['dev'].find(dev) < 0:
 		return
-	print "%7s %5d %6d.%06dsec %12.3fmsec      %12.3fmsec" % \
+	print("%7s %5d %6d.%06dsec %12.3fmsec      %12.3fmsec" % \
 		(hunk['dev'], hunk['len'],
 		nsecs_secs(hunk['queue_t']),
 		nsecs_nsecs(hunk['queue_t'])/1000,
 		diff_msec(hunk['queue_t'], hunk['xmit_t']),
-		diff_msec(hunk['xmit_t'], hunk['free_t']))
+		diff_msec(hunk['xmit_t'], hunk['free_t'])))
 
 # Format for displaying rx packet processing
 PF_IRQ_ENTRY= "  irq_entry(+%.3fmsec irq=%d:%s)"
@@ -98,55 +99,55 @@ def print_receive(hunk):
 	if show_hunk == 0:
 		return
 
-	print "%d.%06dsec cpu=%d" % \
-		(nsecs_secs(base_t), nsecs_nsecs(base_t)/1000, cpu)
+	print("%d.%06dsec cpu=%d" % \
+		(nsecs_secs(base_t), nsecs_nsecs(base_t)/1000, cpu))
 	for i in range(len(irq_list)):
-		print PF_IRQ_ENTRY % \
+		print(PF_IRQ_ENTRY % \
 			(diff_msec(base_t, irq_list[i]['irq_ent_t']),
-			irq_list[i]['irq'], irq_list[i]['name'])
-		print PF_JOINT
+			irq_list[i]['irq'], irq_list[i]['name']))
+		print(PF_JOINT)
 		irq_event_list = irq_list[i]['event_list']
 		for j in range(len(irq_event_list)):
 			irq_event = irq_event_list[j]
 			if irq_event['event'] == 'netif_rx':
-				print PF_NET_RX % \
+				print(PF_NET_RX % \
 					(diff_msec(base_t, irq_event['time']),
-					irq_event['skbaddr'])
-				print PF_JOINT
-	print PF_SOFT_ENTRY % \
-		diff_msec(base_t, hunk['sirq_ent_t'])
-	print PF_JOINT
+					irq_event['skbaddr']))
+				print(PF_JOINT)
+	print(PF_SOFT_ENTRY % \
+		diff_msec(base_t, hunk['sirq_ent_t']))
+	print(PF_JOINT)
 	event_list = hunk['event_list']
 	for i in range(len(event_list)):
 		event = event_list[i]
 		if event['event_name'] == 'napi_poll':
-			print PF_NAPI_POLL % \
-			    (diff_msec(base_t, event['event_t']), event['dev'])
+			print(PF_NAPI_POLL % \
+			    (diff_msec(base_t, event['event_t']), event['dev']))
 			if i == len(event_list) - 1:
-				print ""
+				print("")
 			else:
-				print PF_JOINT
+				print(PF_JOINT)
 		else:
-			print PF_NET_RECV % \
+			print(PF_NET_RECV % \
 			    (diff_msec(base_t, event['event_t']), event['skbaddr'],
-				event['len'])
+				event['len']))
 			if 'comm' in event.keys():
-				print PF_WJOINT
-				print PF_CPY_DGRAM % \
+				print(PF_WJOINT)
+				print(PF_CPY_DGRAM % \
 					(diff_msec(base_t, event['comm_t']),
-					event['pid'], event['comm'])
+					event['pid'], event['comm']))
 			elif 'handle' in event.keys():
-				print PF_WJOINT
+				print(PF_WJOINT)
 				if event['handle'] == "kfree_skb":
-					print PF_KFREE_SKB % \
+					print(PF_KFREE_SKB % \
 						(diff_msec(base_t,
 						event['comm_t']),
-						event['location'])
+						event['location']))
 				elif event['handle'] == "consume_skb":
-					print PF_CONS_SKB % \
+					print(PF_CONS_SKB % \
 						diff_msec(base_t,
-							event['comm_t'])
-			print PF_JOINT
+							event['comm_t']))
+			print(PF_JOINT)
 
 def trace_begin():
 	global show_tx
@@ -210,19 +211,19 @@ def trace_end():
 			print_receive(receive_hunk_list[i])
 	# display transmit hunks
 	if show_tx:
-		print "   dev    len      Qdisc        " \
-			"       netdevice             free"
+		print("   dev    len      Qdisc        " \
+			"       netdevice             free")
 		for i in range(len(tx_free_list)):
 			print_transmit(tx_free_list[i])
 	if debug:
-		print "debug buffer status"
-		print "----------------------------"
-		print "xmit Qdisc:remain:%d overflow:%d" % \
-			(len(tx_queue_list), of_count_tx_queue_list)
-		print "xmit netdevice:remain:%d overflow:%d" % \
-			(len(tx_xmit_list), of_count_tx_xmit_list)
-		print "receive:remain:%d overflow:%d" % \
-			(len(rx_skb_list), of_count_rx_skb_list)
+		print("debug buffer status")
+		print("----------------------------")
+		print("xmit Qdisc:remain:%d overflow:%d" % \
+			(len(tx_queue_list), of_count_tx_queue_list))
+		print("xmit netdevice:remain:%d overflow:%d" % \
+			(len(tx_xmit_list), of_count_tx_xmit_list))
+		print("receive:remain:%d overflow:%d" % \
+			(len(rx_skb_list), of_count_rx_skb_list))
 
 # called from perf, when it finds a correspoinding event
 def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, callchain, vec):
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to net_dropmonitor.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (7 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to powerpc-hcalls.py Seeteena Thoufeek
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in net_dropmonitor.py.
``print`` is now a function rather than a statement. This should
have no functional change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/net_dropmonitor.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index a150164..88fe4a2 100755
--- a/tools/perf/scripts/python/net_dropmonitor.py
+++ b/tools/perf/scripts/python/net_dropmonitor.py
@@ -1,5 +1,6 @@
 # Monitor the system for dropped packets and proudce a report of drop locations and counts
 # SPDX-License-Identifier: GPL-2.0
+from __future__ import print_function
 
 import os
 import sys
@@ -50,19 +51,19 @@ def get_sym(sloc):
 		return (None, 0)
 
 def print_drop_table():
-	print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")
+	print("%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT"))
 	for i in drop_log.keys():
 		(sym, off) = get_sym(i)
 		if sym == None:
 			sym = i
-		print "%25s %25s %25s" % (sym, off, drop_log[i])
+		print("%25s %25s %25s" % (sym, off, drop_log[i]))
 
 
 def trace_begin():
-	print "Starting trace (Ctrl-C to dump results)"
+	print("Starting trace (Ctrl-C to dump results)")
 
 def trace_end():
-	print "Gathering kallsyms data"
+	print("Gathering kallsyms data")
 	get_kallsyms_table()
 	print_drop_table()
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to powerpc-hcalls.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (8 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to net_dropmonitor.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to sctop.py Seeteena Thoufeek
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in powerpc-hcalls.py.
``print`` is now a function rather than a statement. This should
have no functional change.

The "has_key()" method is deprecated in favor of the "in" operator.
So incorporate those changes here.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/powerpc-hcalls.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/scripts/python/powerpc-hcalls.py b/tools/perf/scripts/python/powerpc-hcalls.py
index 00e0e74..19ff684 100644
--- a/tools/perf/scripts/python/powerpc-hcalls.py
+++ b/tools/perf/scripts/python/powerpc-hcalls.py
@@ -3,6 +3,7 @@
 # Copyright (C) 2018 Ravi Bangoria, IBM Corporation
 #
 # Hypervisor call statisics
+from __future__ import print_function
 
 import os
 import sys
@@ -149,7 +150,7 @@ hcall_table = {
 }
 
 def hcall_table_lookup(opcode):
-	if (hcall_table.has_key(opcode)):
+	if (opcode in hcall_table):
 		return hcall_table[opcode]
 	else:
 		return opcode
@@ -157,8 +158,8 @@ def hcall_table_lookup(opcode):
 print_ptrn = '%-28s%10s%10s%10s%10s'
 
 def trace_end():
-	print print_ptrn % ('hcall', 'count', 'min(ns)', 'max(ns)', 'avg(ns)')
-	print '-' * 68
+	print(print_ptrn % ('hcall', 'count', 'min(ns)', 'max(ns)', 'avg(ns)'))
+	print('-' * 68)
 	for opcode in output:
 		h_name = hcall_table_lookup(opcode)
 		time = output[opcode]['time']
@@ -166,14 +167,14 @@ def trace_end():
 		min_t = output[opcode]['min']
 		max_t = output[opcode]['max']
 
-		print print_ptrn % (h_name, cnt, min_t, max_t, time/cnt)
+		print(print_ptrn % (h_name, cnt, min_t, max_t, time/cnt))
 
 def powerpc__hcall_exit(name, context, cpu, sec, nsec, pid, comm, callchain,
 			opcode, retval):
-	if (d_enter.has_key(cpu) and d_enter[cpu].has_key(opcode)):
+	if ((cpu in d_enter) and (opcode in d_enter[cpu])):
 		diff = nsecs(sec, nsec) - d_enter[cpu][opcode]
 
-		if (output.has_key(opcode)):
+		if (opcode in output):
 			output[opcode]['time'] += diff
 			output[opcode]['cnt'] += 1
 			if (output[opcode]['min'] > diff):
@@ -194,7 +195,7 @@ def powerpc__hcall_exit(name, context, cpu, sec, nsec, pid, comm, callchain,
 
 def powerpc__hcall_entry(event_name, context, cpu, sec, nsec, pid, comm,
 			 callchain, opcode):
-		if (d_enter.has_key(cpu)):
+		if (cpu in d_enter):
 			d_enter[cpu][opcode] = nsecs(sec, nsec)
 		else:
 			d_enter[cpu] = {opcode: nsecs(sec, nsec)}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to sctop.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (9 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to powerpc-hcalls.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:27   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py Seeteena Thoufeek
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in sctop.py.``print``
is now a function rather than a statement. This should have no
functional change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/sctop.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 61621b9..d059a2a 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -7,6 +7,7 @@
 # [comm] are displayed. If an [interval] arg is specified, the display
 # will be refreshed every [interval] seconds.  The default interval is
 # 3 seconds.
+from __future__ import print_function
 
 import os, sys, thread, time
 
@@ -62,18 +63,18 @@ def print_syscall_totals(interval):
 	while 1:
 		clear_term()
 		if for_comm is not None:
-			print "\nsyscall events for %s:\n\n" % (for_comm),
+			print("\nsyscall events for %s:\n\n" % (for_comm)),
 		else:
-			print "\nsyscall events:\n\n",
+			print("\nsyscall events:\n\n"),
 
-		print "%-40s  %10s\n" % ("event", "count"),
-		print "%-40s  %10s\n" % ("----------------------------------------", \
-						 "----------"),
+		print("%-40s  %10s\n" % ("event", "count")),
+		print("%-40s  %10s\n" % ("----------------------------------------", \
+						 "----------")),
 
-		for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
+		for id, val in sorted(syscalls.iteritems(), key = lambda k_v: (k_v[1], k_v[0]), \
 					      reverse = True):
 			try:
-				print "%-40s  %10d\n" % (syscall_name(id), val),
+				print("%-40s  %10d\n" % (syscall_name(id), val)),
 			except TypeError:
 				pass
 		syscalls.clear()
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (10 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to sctop.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  1:46   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stat-cpi.py Seeteena Thoufeek
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in stackcollapse.py. ``print`` is now a
function rather than a statement. This should have no functional change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/stackcollapse.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/stackcollapse.py b/tools/perf/scripts/python/stackcollapse.py
index 1697b5e..f77bc0d 100755
--- a/tools/perf/scripts/python/stackcollapse.py
+++ b/tools/perf/scripts/python/stackcollapse.py
@@ -18,6 +18,7 @@
 #
 # Written by Paolo Bonzini <pbonzini@redhat.com>
 # Based on Brendan Gregg's stackcollapse-perf.pl script.
+from __future__ import print_function
 
 import os
 import sys
@@ -123,4 +124,4 @@ def trace_end():
     list = lines.keys()
     list.sort()
     for stack in list:
-        print "%s %d" % (stack, lines[stack])
+        print("%s %d" % (stack, lines[stack]))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to stat-cpi.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (11 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py Seeteena Thoufeek
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in stat-cpi.py. ``print``
is now a function rather than a statement. This should have no
functional change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/stat-cpi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/stat-cpi.py b/tools/perf/scripts/python/stat-cpi.py
index 8410672..1d8e8b7 100644
--- a/tools/perf/scripts/python/stat-cpi.py
+++ b/tools/perf/scripts/python/stat-cpi.py
@@ -59,7 +59,7 @@ 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
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (12 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stat-cpi.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-19  0:53   ` Tony Jones
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts.py Seeteena Thoufeek
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in syscall-counts-by-pid.py. ``print``
is now a function rather than a statement. This should have no functional
change.

Fix lambda syntax error.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/syscall-counts-by-pid.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py
index daf314c..3146094 100644
--- a/tools/perf/scripts/python/syscall-counts-by-pid.py
+++ b/tools/perf/scripts/python/syscall-counts-by-pid.py
@@ -4,6 +4,7 @@
 #
 # Displays system-wide system call totals, broken down by syscall.
 # If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+from __future__ import print_function
 
 import os, sys
 
@@ -31,7 +32,7 @@ if len(sys.argv) > 1:
 syscalls = autodict()
 
 def trace_begin():
-	print "Press control+C to stop and show the summary"
+	print("Press control+C to stop and show the summary")
 
 def trace_end():
 	print_syscall_totals()
@@ -55,20 +56,20 @@ def syscalls__sys_enter(event_name, context, common_cpu,
 
 def print_syscall_totals():
     if for_comm is not None:
-	    print "\nsyscall events for %s:\n\n" % (for_comm),
+	    print("\nsyscall events for %s:\n\n" % (for_comm)),
     else:
-	    print "\nsyscall events by comm/pid:\n\n",
+	    print("\nsyscall events by comm/pid:\n\n"),
 
-    print "%-40s  %10s\n" % ("comm [pid]/syscalls", "count"),
-    print "%-40s  %10s\n" % ("----------------------------------------", \
-                                 "----------"),
+    print("%-40s  %10s\n" % ("comm [pid]/syscalls", "count")),
+    print("%-40s  %10s\n" % ("----------------------------------------", \
+                                 "----------")),
 
     comm_keys = syscalls.keys()
     for comm in comm_keys:
 	    pid_keys = syscalls[comm].keys()
 	    for pid in pid_keys:
-		    print "\n%s [%d]\n" % (comm, pid),
+		    print("\n%s [%d]\n" % (comm, pid)),
 		    id_keys = syscalls[comm][pid].keys()
 		    for id, val in sorted(syscalls[comm][pid].iteritems(), \
-				  key = lambda(k, v): (v, k),  reverse = True):
-			    print "  %-38s  %10d\n" % (syscall_name(id), val),
+				  key = lambda k_v: (k_v[1], k_v[0]),  reverse = True):
+			    print("  %-38s  %10d\n" % (syscall_name(id), val)),
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (13 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-postgresql.py Seeteena Thoufeek
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in syscall-counts.py. ``print``
is now a function rather than a statement. This should have no
functional change.

Fix lambda syntax error

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/syscall-counts.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
index e66a773..6ca67bd 100644
--- a/tools/perf/scripts/python/syscall-counts.py
+++ b/tools/perf/scripts/python/syscall-counts.py
@@ -4,6 +4,7 @@
 #
 # Displays system-wide system call totals, broken down by syscall.
 # If a [comm] arg is specified, only syscalls called by [comm] are displayed.
+from __future__ import print_function
 
 import os
 import sys
@@ -28,7 +29,7 @@ if len(sys.argv) > 1:
 syscalls = autodict()
 
 def trace_begin():
-	print "Press control+C to stop and show the summary"
+	print("Press control+C to stop and show the summary")
 
 def trace_end():
 	print_syscall_totals()
@@ -51,14 +52,14 @@ def syscalls__sys_enter(event_name, context, common_cpu,
 
 def print_syscall_totals():
     if for_comm is not None:
-	    print "\nsyscall events for %s:\n\n" % (for_comm),
+	    print("\nsyscall events for %s:\n\n" % (for_comm)),
     else:
-	    print "\nsyscall events:\n\n",
+	    print("\nsyscall events:\n\n"),
 
-    print "%-40s  %10s\n" % ("event", "count"),
-    print "%-40s  %10s\n" % ("----------------------------------------", \
-                                 "-----------"),
+    print("%-40s  %10s\n" % ("event", "count")),
+    print("%-40s  %10s\n" % ("----------------------------------------", \
+                                 "-----------")),
 
-    for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
+    for id, val in sorted(syscalls.iteritems(), key = lambda k_v: (k_v[1], k_v[0]), \
 				  reverse = True):
-	    print "%-40s  %10d\n" % (syscall_name(id), val),
+	    print("%-40s  %10d\n" % (syscall_name(id), val)),
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2] perf scripts python: Add Python 3 support to export-to-postgresql.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (14 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts.py Seeteena Thoufeek
@ 2019-01-17  9:45 ` Seeteena Thoufeek
  2019-01-17 12:32 ` [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Jiri Olsa
  2019-01-19  0:59 ` Tony Jones
  17 siblings, 0 replies; 34+ messages in thread
From: Seeteena Thoufeek @ 2019-01-17  9:45 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung, linux-kernel
  Cc: s1seetee

Support both Python 2 and Python 3 in export-to-postgresql.py. ``print``
is now a function rather than a statement. This should have no functional
change.

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/scripts/python/export-to-postgresql.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index 0564dd7..82e10a6 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -9,6 +9,7 @@
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 # more details.
+from __future__ import print_function
 
 import os
 import sys
@@ -273,7 +274,7 @@ def do_query(q, s):
 		return
 	raise Exception("Query failed: " + q.lastError().text())
 
-print datetime.datetime.today(), "Creating database..."
+print(datetime.datetime.today(), "Creating database...")
 
 db = QSqlDatabase.addDatabase('QPSQL')
 query = QSqlQuery(db)
@@ -564,7 +565,7 @@ if perf_db_export_calls:
 	call_file		= open_output_file("call_table.bin")
 
 def trace_begin():
-	print datetime.datetime.today(), "Writing to intermediate files..."
+	print(datetime.datetime.today(), "Writing to intermediate files...")
 	# id == 0 means unknown.  It is easier to create records for them than replace the zeroes with NULLs
 	evsel_table(0, "unknown")
 	machine_table(0, 0, "unknown")
@@ -579,7 +580,7 @@ def trace_begin():
 unhandled_count = 0
 
 def trace_end():
-	print datetime.datetime.today(), "Copying to database..."
+	print(datetime.datetime.today(), "Copying to database...")
 	copy_output_file(evsel_file,		"selected_events")
 	copy_output_file(machine_file,		"machines")
 	copy_output_file(thread_file,		"threads")
@@ -594,7 +595,7 @@ def trace_end():
 	if perf_db_export_calls:
 		copy_output_file(call_file,		"calls")
 
-	print datetime.datetime.today(), "Removing intermediate files..."
+	print(datetime.datetime.today(), "Removing intermediate files...")
 	remove_output_file(evsel_file)
 	remove_output_file(machine_file)
 	remove_output_file(thread_file)
@@ -609,7 +610,7 @@ def trace_end():
 	if perf_db_export_calls:
 		remove_output_file(call_file)
 	os.rmdir(output_dir_name)
-	print datetime.datetime.today(), "Adding primary keys"
+	print(datetime.datetime.today(), "Adding primary keys")
 	do_query(query, 'ALTER TABLE selected_events ADD PRIMARY KEY (id)')
 	do_query(query, 'ALTER TABLE machines        ADD PRIMARY KEY (id)')
 	do_query(query, 'ALTER TABLE threads         ADD PRIMARY KEY (id)')
@@ -624,7 +625,7 @@ def trace_end():
 	if perf_db_export_calls:
 		do_query(query, 'ALTER TABLE calls           ADD PRIMARY KEY (id)')
 
-	print datetime.datetime.today(), "Adding foreign keys"
+	print(datetime.datetime.today(), "Adding foreign keys")
 	do_query(query, 'ALTER TABLE threads '
 					'ADD CONSTRAINT machinefk  FOREIGN KEY (machine_id)   REFERENCES machines   (id),'
 					'ADD CONSTRAINT processfk  FOREIGN KEY (process_id)   REFERENCES threads    (id)')
@@ -659,8 +660,8 @@ def trace_end():
 		do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)')
 
 	if (unhandled_count):
-		print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events"
-	print datetime.datetime.today(), "Done"
+		print(datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events")
+	print(datetime.datetime.today(), "Done")
 
 def trace_unhandled(event_name, context, event_fields_dict):
 	global unhandled_count
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (15 preceding siblings ...)
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-postgresql.py Seeteena Thoufeek
@ 2019-01-17 12:32 ` Jiri Olsa
  2019-01-17 13:23   ` Ravi Bangoria
  2019-01-19  0:29   ` Tony Jones
  2019-01-19  0:59 ` Tony Jones
  17 siblings, 2 replies; 34+ messages in thread
From: Jiri Olsa @ 2019-01-17 12:32 UTC (permalink / raw)
  To: Seeteena Thoufeek
  Cc: peterz, mingo, acme, alexander.shishkin, namhyung, linux-kernel

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@linux.vnet.ibm.com>
> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

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

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
  2019-01-17 12:32 ` [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Jiri Olsa
@ 2019-01-17 13:23   ` Ravi Bangoria
  2019-01-19  0:29   ` Tony Jones
  1 sibling, 0 replies; 34+ messages in thread
From: Ravi Bangoria @ 2019-01-17 13:23 UTC (permalink / raw)
  To: Jiri Olsa, Seeteena Thoufeek
  Cc: peterz, mingo, acme, alexander.shishkin, namhyung, linux-kernel,
	Ravi Bangoria

Hi Seeteena, Jiri,

On 1/17/19 6:02 PM, Jiri Olsa wrote:
> 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@linux.vnet.ibm.com>
>> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> 
> 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

Yes I'm seeing the same error with check-perf-trace.py.

I think the issue happens only when we use 'perf script -s path/to/script.py'
instead of 'perf script report script_name':

Ex:

  # PERF_EXEC_PATH=`pwd` ./perf.python3 script record stackcollapse
    ^C[ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.263 MB perf.data (497 samples) ]

  # PERF_EXEC_PATH=`pwd` ./perf.python3 script report stackcollapse
    migration/21 1
    migration/41 1
    perf 9
    rngd 1
    sshd 1
    swapper 482
    xfsaild/sda5 2

  # PERF_EXEC_PATH=`pwd` ./perf.python3 script -s scripts/python/stackcollapse.py 
    Traceback (most recent call last):
      File "scripts/python/stackcollapse.py", line 31, in <module>
        from perf_trace_context import *
    ModuleNotFoundError: No module named 'perf_trace_context'
    Error running python script scripts/python/stackcollapse.py

So, it seems, this is not the script issue. Something is wrong when we build perf
with python3?


Here is my test summary on Powerpc Fedora 29:

                              Python2           Python3
 check-perf-trace.py          ok                FAIL (No module named 'perf_trace_context')
 event_analyzing_sample.py    ok                ok
 export-to-sqlite.py          ok                ok
 exported-sql-viewer.py       ok                FAIL (details at the end)
 export-to-postgresql.py      FAIL              FAIL
 failed-syscalls-by-pid.py    ok                ok
 futex-contention.py          ok                ok
 intel-pt-events.py           NOT TESTED        NOT TESTED
 mem-phys-addr.py             NOT TESTED        NOT TESTED
 net_dropmonitor.py           ok                ok
 netdev-times.py              ok                ok
 powerpc-hcalls.py            ok                ok
 sctop.py                     ok                ok
 stackcollapse.py             ok                ok
 stat-cpi.py                  FAIL (Seg fault)  FAIL (Seg fault)
 syscall-counts-by-pid.py     ok                ok
 syscall-counts.py            ok                ok


exported-sql-viewer.py FAILURE:
===============================
  # PERF_EXEC_PATH=`pwd` ./perf.python3 script -s ./scripts/python/exported-sql-viewer.py my_test_db
    Traceback (most recent call last):
    File "./scripts/python/exported-sql-viewer.py", line 2614, in <module>
       Main()
    File "./scripts/python/exported-sql-viewer.py", line 2601, in Main
      db, dbname = dbref.Open("main")
    File "./scripts/python/exported-sql-viewer.py", line 2573, in Open
      raise Exception("Failed to open database " + dbname + " error: " + db.lastError().text())
    Exception: Failed to open database my_test_db error: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    QPSQL: Unable to connect
    Error running python script ./scripts/python/exported-sql-viewer.py

Thanks,
Ravi


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
  2019-01-17 12:32 ` [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Jiri Olsa
  2019-01-17 13:23   ` Ravi Bangoria
@ 2019-01-19  0:29   ` Tony Jones
  2019-01-19  2:05     ` Tony Jones
  1 sibling, 1 reply; 34+ messages in thread
From: Tony Jones @ 2019-01-19  0:29 UTC (permalink / raw)
  To: Jiri Olsa, Seeteena Thoufeek
  Cc: peterz, mingo, acme, alexander.shishkin, namhyung, linux-kernel

On 1/17/19 4:32 AM, Jiri Olsa wrote:
> 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@linux.vnet.ibm.com>
>> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> 
> 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
> 

I'd been simultaneously working on a patch set to fix up Python3.  

It's actually already in our Factory and SLE15-SP1 releases as we had a deadline to kill Python2 usage for internal rpms. 

I was going to post once I'd fixed the last remaining issue ('import perf' is still failing [test #18]).   

I guess "you snooze you lose" :-)

https://build.opensuse.org/package/view_file/devel:tools/perf/perf.changes?expand=1

Anyhow,  the fix for the above is: 'add-trace_context-extension-module-to-sys-modules.patch' from above.

Attached below.  Verified with PYTHON=python2 and PYTHON=python3

Tony

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

In Python3,  the result of PyModule_Create (called from
scripts/python/Perf-Trace-Util/Context.c) is not automatically added to 
sys.modules.  See: https://bugs.python.org/issue4592

Below is the observed behavior without the fix.

# ldd /usr/bin/perf | grep -i python
	libpython3.6m.so.1.0 => /usr/lib64/libpython3.6m.so.1.0 (0x00007f8e1dfb2000)

# perf record -a -e raw_syscalls:sys_enter sleep 5
[ perf record: Woken up 0 times to write data ]
[ perf record: Captured and wrote 187.177 MB perf.data (1581501 samples) ]

# perf script -g python | cat
generated Python script: perf-script.py

# perf script -s ./perf-script.py
Traceback (most recent call last):
  File "./perf-script.py", line 18, in <module>
    from perf_trace_context import *
ModuleNotFoundError: No module named 'perf_trace_context'
Error running python script ./perf-script.py

Signed-off-by: Tony Jones <tonyj@suse.de>
---
 tools/perf/util/scripting-engines/trace-event-python.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1494,6 +1494,7 @@ static void _free_command_line(wchar_t *
 static int python_start_script(const char *script, int argc, const char **argv)
 {
 	struct tables *tables = &tables_global;
+	PyMODINIT_FUNC (*initfunc)(void);
 #if PY_MAJOR_VERSION < 3
 	const char **command_line;
 #else
@@ -1504,24 +1505,25 @@ static int python_start_script(const cha
 	FILE *fp;
 
 #if PY_MAJOR_VERSION < 3
+	initfunc = initperf_trace_context;
 	command_line = malloc((argc + 1) * sizeof(const char *));
 	command_line[0] = script;
 	for (i = 1; i < argc + 1; i++)
 		command_line[i] = argv[i - 1];
 #else
+	initfunc = PyInit_perf_trace_context;
 	command_line = malloc((argc + 1) * sizeof(wchar_t *));
 	command_line[0] = Py_DecodeLocale(script, NULL);
 	for (i = 1; i < argc + 1; i++)
 		command_line[i] = Py_DecodeLocale(argv[i - 1], NULL);
 #endif
 
+	PyImport_AppendInittab("perf_trace_context", initfunc);
 	Py_Initialize();
 
 #if PY_MAJOR_VERSION < 3
-	initperf_trace_context();
 	PySys_SetArgv(argc + 1, (char **)command_line);
 #else
-	PyInit_perf_trace_context();
 	PySys_SetArgv(argc + 1, command_line);
 #endif
 





^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py Seeteena Thoufeek
@ 2019-01-19  0:45   ` Tony Jones
  2019-01-20 19:27     ` Jonathan Corbet
  2019-01-21 10:45     ` seeteena
  0 siblings, 2 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  0:45 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:

> +if sys.version_info[0] < 3:
> +    import cPickle
> +else:
> +    import _pickle as cPickle

Do you really need this?

pickle is already in Python2.

Also, did you test these changes on Python3?  

I think you'll find you also need the following hunk otherwise you're running into Unicode diffs on Py3.

@@ -2590,8 +2590,8 @@ def Main():

        is_sqlite3 = False
        try:
-               f = open(dbname)
-               if f.read(15) == "SQLite format 3":
+               f = open(dbname, "rb")
+               if f.read(15) == b'SQLite format 3':
                        is_sqlite3 = True
                f.close()
        except:

Plus you need to handle the conversion of "print >> sys.stderr"

Attached is my version (against tip):

--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -91,7 +91,7 @@ import sys
 import weakref
 import threading
 import string
-import cPickle
+import pickle
 import re
 import os
 from PySide.QtCore import *
@@ -1559,7 +1559,7 @@ class SQLTableDialogDataItem():
 					return str(lower_id)
 
 	def ConvertRelativeTime(self, val):
-		print "val ", val
+		print("val ", val)
 		mult = 1
 		suffix = val[-2:]
 		if suffix == "ms":
@@ -1581,29 +1581,29 @@ class SQLTableDialogDataItem():
 		return str(val)
 
 	def ConvertTimeRange(self, vrange):
-		print "vrange ", vrange
+		print("vrange ", vrange)
 		if vrange[0] == "":
 			vrange[0] = str(self.first_time)
 		if vrange[1] == "":
 			vrange[1] = str(self.last_time)
 		vrange[0] = self.ConvertRelativeTime(vrange[0])
 		vrange[1] = self.ConvertRelativeTime(vrange[1])
-		print "vrange2 ", vrange
+		print("vrange2 ", vrange)
 		if not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]):
 			return False
-		print "ok1"
+		print("ok1")
 		beg_range = max(int(vrange[0]), self.first_time)
 		end_range = min(int(vrange[1]), self.last_time)
 		if beg_range > self.last_time or end_range < self.first_time:
 			return False
-		print "ok2"
+		print("ok2")
 		vrange[0] = self.BinarySearchTime(0, self.last_id, beg_range, True)
 		vrange[1] = self.BinarySearchTime(1, self.last_id + 1, end_range, False)
-		print "vrange3 ", vrange
+		print("vrange3 ", vrange)
 		return True
 
 	def AddTimeRange(self, value, ranges):
-		print "value ", value
+		print("value ", value)
 		n = value.count("-")
 		if n == 1:
 			pass
@@ -2577,7 +2577,7 @@ class DBRef():
 
 def Main():
 	if (len(sys.argv) < 2):
-		print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}"
+		sys.stderr.write("Usage is: exported-sql-viewer.py {<database name> | --help-only}\n");
 		raise Exception("Too few arguments")
 
 	dbname = sys.argv[1]
@@ -2590,8 +2590,8 @@ def Main():
 
 	is_sqlite3 = False
 	try:
-		f = open(dbname)
-		if f.read(15) == "SQLite format 3":
+		f = open(dbname, "rb")
+		if f.read(15) == b'SQLite format 3':
 			is_sqlite3 = True
 		f.close()
 	except:






^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py Seeteena Thoufeek
@ 2019-01-19  0:53   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  0:53 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:

> -	    print "\nsyscall events for %s:\n\n" % (for_comm),
> +	    print("\nsyscall events for %s:\n\n" % (for_comm)),
>      else:
> -	    print "\nsyscall events by comm/pid:\n\n",
> +	    print("\nsyscall events by comm/pid:\n\n"),
>  
> -    print "%-40s  %10s\n" % ("comm [pid]/syscalls", "count"),
> -    print "%-40s  %10s\n" % ("----------------------------------------", \
> -                                 "----------"),
> +    print("%-40s  %10s\n" % ("comm [pid]/syscalls", "count")),
> +    print("%-40s  %10s\n" % ("----------------------------------------", \
> +                                 "----------")),

Is the 'print (x),' [trailing comma] syntax valid for function syntax?

Print "x", in Py2 means suppress the trailing newline.

You need to actually run the scripts (old,  new PYTHON=python2, new PYTHON=python3) and compare the output.

This:
print "%-40s  %10s\n" % ("comm [pid]/syscalls", "count"),

can be reworked as:
print ("%-40s  %10s" % ("comm [pid]/syscalls", "count"))


See:  https://build.opensuse.org/package/view_file/devel:tools/perf/port-failed-syscalls-by-pid-script-to-python3.patch?expand=1

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
  2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
                   ` (16 preceding siblings ...)
  2019-01-17 12:32 ` [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Jiri Olsa
@ 2019-01-19  0:59 ` Tony Jones
  17 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  0:59 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:

> -		print "vec=%s\n" % \
> -		(symbol_str("irq__softirq_entry", "vec", vec)),
> +		print("vec=%s\n" % \
> +		(symbol_str("irq__softirq_entry", "vec", vec))),

Again, check the trailing comma usage:

$ echo 'print "abc", ; print "def"' | python2
abc def
$ echo 'print ("abc"), ; print ("def")' | python2
abc def
$ echo 'print ("abc"), ; print ("def")' | python3
abc
def

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py Seeteena Thoufeek
@ 2019-01-19  1:05   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:05 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
> Support both Python 2 and Python 3 in export-to-sqlite.py. ``print`` is
> now a function rather than a statement. This should have no functional
> change.

I don't see any changes handling the following:

$ git annotate tools/perf/scripts/python/export-to-sqlite.py | grep ">> sys"
564b9527d1ccf	(Adrian Hunter	2017-08-03 11:31:28 +0300	64)	print >> sys.stderr, "Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]"
564b9527d1ccf	(Adrian Hunter	2017-08-03 11:31:28 +0300	65)	print >> sys.stderr, "where:	columns		'all' or 'branches'"
564b9527d1ccf	(Adrian Hunter	2017-08-03 11:31:28 +0300	66)	print >> sys.stderr, "		calls		'calls' => create calls and call_paths table"
564b9527d1ccf	(Adrian Hunter	2017-08-03 11:31:28 +0300	67)	print >> sys.stderr, "		callchains	'callchains' => create call_paths table"

$ echo 'import sys ; print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}"' | python2
Usage is: exported-sql-viewer.py {<database name> | --help-only}

$ echo 'import sys ; print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}"' | python3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and '_io.TextIOWrapper'. Did you mean "print(<message>, file=<output_stream>)"?


They are best handled via conversion to sys.stderr.write() since sys is already imported.

Tony

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py Seeteena Thoufeek
@ 2019-01-19  1:12   ` Tony Jones
  2019-01-19  2:37     ` Tony Jones
  0 siblings, 1 reply; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:12 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:

> +from __future__ import print_function

You don't need this unless you're actually requiring functionality that only exists in v3.
For example, you need it to handle the suppress newline functionality such as "end=".

>  def print_error_totals():
>      if for_comm is not None:
> -	    print "\nsyscall errors for %s:\n\n" % (for_comm),
> +	    print("\nsyscall errors for %s:\n\n" % (for_comm)),
>      else:
> -	    print "\nsyscall errors:\n\n",
> +	    print("\nsyscall errors:\n\n"),
>  
> -    print "%-30s  %10s\n" % ("comm [pid]", "count"),
> -    print "%-30s  %10s\n" % ("------------------------------", \
> -                                 "----------"),
> +    print("%-30s  %10s\n" % ("comm [pid]", "count")),
> +    print("%-30s  %10s\n" % ("------------------------------", \
> +                                 "----------")),

Same comments as before regarding trailing comma for function.

See: https://build.opensuse.org/package/view_file/devel:tools/perf/port-failed-syscalls-by-pid-script-to-python3.patch?expand=1

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py Seeteena Thoufeek
@ 2019-01-19  1:16   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:16 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
> Support both Python 2 and Python 3 in intel-pt-events.py.``print``
> is now a function rather than a statement. This should have no
> functional change.
> 
> Fixes indentation issue, replace spaces with tab.

Again,  trailing comma use is incorrect.


> -	print "%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name),
> +	print("%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name)),

print ("%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name), end='')

and so on for rest of changes.

Tony

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py Seeteena Thoufeek
@ 2019-01-19  1:21   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:21 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:> Support both Python 2 and Python 3 in netdev-times.py. ``print``
> is now a function rather than a statement. This should have no
> functional change.

Same feedback as all the other patches applies.

In addition:

$ git annotate tools/perf/scripts/python/netdev-times.py | grep "all_event_list.sort"
359d5106a2ff4	(Koki Sanagi	2010-08-23 18:47:09 +0900	175)	all_event_list.sort(lambda a,b :cmp(a[EINFO_IDX_TIME],

I didn't think the above was valid with Python3.

In my version (https://build.opensuse.org/package/view_file/devel:tools/perf/port-failed-syscalls-by-pid-script-to-python3.patch?expand=1)
I reworked it as:

from functools import cmp_to_key
all_event_list.sort(key=cmp_to_key(lambda a,b :a[EINFO_IDX_TIME] < b[EINFO_IDX_TIME]))

Tony

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to sctop.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to sctop.py Seeteena Thoufeek
@ 2019-01-19  1:27   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:27 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:

> +from __future__ import print_function

Again, you don't need this.


> -			print "\nsyscall events for %s:\n\n" % (for_comm),
> +			print("\nsyscall events for %s:\n\n" % (for_comm)),

same comments regarding trailing comma usage

$ git annotate tools/perf/scripts/python/sctop.py | grep thread
2e7d1e3fb8043	(Arnaldo Carvalho de Melo	2010-10-25 18:39:20 -0200	11)import os, sys, thread, time
47902f3611b39	(Tom Zanussi	2010-04-01 23:59:23 -0500	42)	thread.start_new_thread(print_syscall_totals, (interval,))

The low level threading api has changed in the most recent Python versions.   I think you'll find you also need:

@@ -8,7 +8,12 @@
 # will be refreshed every [interval] seconds.  The default interval is
 # 3 seconds.

-import os, sys, thread, time
+import os, sys, time
+
+try:
+        import thread
+except ImportError:
+        import _thread as thread



Tony

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py
  2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py Seeteena Thoufeek
@ 2019-01-19  1:46   ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  1:46 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel, Ravi Bangoria

On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
> Support both Python 2 and Python 3 in stackcollapse.py. ``print`` is now a
> function rather than a statement. This should have no functional change.
> 
> Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
>  tools/perf/scripts/python/stackcollapse.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/scripts/python/stackcollapse.py b/tools/perf/scripts/python/stackcollapse.py
> index 1697b5e..f77bc0d 100755
> --- a/tools/perf/scripts/python/stackcollapse.py
> +++ b/tools/perf/scripts/python/stackcollapse.py
> @@ -18,6 +18,7 @@
>  #
>  # Written by Paolo Bonzini <pbonzini@redhat.com>
>  # Based on Brendan Gregg's stackcollapse-perf.pl script.
> +from __future__ import print_function

Again, not necessary.
  
>  import os
>  import sys
> @@ -123,4 +124,4 @@ def trace_end():
>      list = lines.keys()
>      list.sort()
>      for stack in list:
> -        print "%s %d" % (stack, lines[stack])
> +        print("%s %d" % (stack, lines[stack]))
> 

Did you test any of these changes with Python3?

If you run 'ldd /usr/bin/perf | grep python' when you've built with PYTHON=python3,  what do you see?

$ ldd /usr/bin/perf | grep python
	libpython3.6m.so.1.0 => /usr/lib64/libpython3.6m.so.1.0 (0x00007fea66701000)

If you do,  you'll run into this error:

$ /usr/bin/perf script -s scripts/python/stackcollapse.py -i /tmp/perf.data
Traceback (most recent call last):
  File "scripts/python/stackcollapse.py", line 124, in trace_end
    list.sort()
AttributeError: 'dict_keys' object has no attribute 'sort'
Fatal Python error: problem in Python trace event handler

You need the following change in addition:

--- a/tools/perf/scripts/python/stackcollapse.py
+++ b/tools/perf/scripts/python/stackcollapse.py
@@ -120,7 +120,6 @@ def process_event(param_dict):
     lines[stack_string] = lines[stack_string] + 1

 def trace_end():
-    list = lines.keys()
-    list.sort()
+    list = sorted(lines)
     for stack in list:
-        print "%s %d" % (stack, lines[stack])
+        print ("%s %d" % (stack, lines[stack]))


As I said in a different post,  I'd not yet posted my series as I was still trying to fix the failure of the "import perf" testcase (aka tools/perf/python) and (apologies) I'd missed your V1 but maybe I should post them as they've been thoroughly integrated into perf and tested with python2 and python3.

The full patchset is in SLE15-SP1 beta2 which I know IBM has access to.  A backport is also in Factory.

Tony




^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py
  2019-01-19  0:29   ` Tony Jones
@ 2019-01-19  2:05     ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  2:05 UTC (permalink / raw)
  To: Jiri Olsa, Seeteena Thoufeek
  Cc: peterz, mingo, acme, alexander.shishkin, namhyung, linux-kernel,
	Ravi Bangoria

On 1/18/19 4:29 PM, Tony Jones wrote:

> I'd been simultaneously working on a patch set to fix up Python3.  
> 
> It's actually already in our Factory and SLE15-SP1 releases as we had a deadline to kill Python2 usage for internal rpms. 
> 
> I was going to post once I'd fixed the last remaining issue ('import perf' is still failing [test #18]).   
> 
> I guess "you snooze you lose" :-)
> 
> https://build.opensuse.org/package/view_file/devel:tools/perf/perf.changes?expand=1

Seeteena, I'm than happy to forward my patches via email. Alternatively, as I said in another post,  the full series is in SLE15-SP1/beta2 (should apply to tip) which IBM has access to and they've been backported to v4.19 (Factory) at https://build.opensuse.org/package/show/openSUSE:Factory/perf.  Everything has been tested against python2 and python3.

Also, in this series there are patches to: 
- port tests/attr.py to Python3
- remove shebangs from the .py scripts and change to mode 644 as IMO it makes no sense to explicitly have #!/usr/bin/python since per pep-0394 this refers to version2 and the system may only have python3 installed
- remove the shebang from setup.py since it's explicitly invoked via call to ${PYTHON_WORD}

Also I found in testing that the following fix is also needed. I'm not 100% sure on it and was going to revisit before posting but _PyUnicode_FromStringAndSize() is definitely unsafe to use on attr.

----

Fixes: 66dfdff03d196e51322c6a85c0d8db8bb2bdd655

With Python3.  PyUnicode_FromStringAndSize is unsafe to call on attr and will
return NULL.  Use _PyBytes_FromStringAndSize (as with raw_buf).

$ perf script -s perf-script.py -i perf.data
in trace_begin
Segmentation fault (core dumped)
---
 tools/perf/util/scripting-engines/trace-event-python.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -733,8 +733,7 @@ static PyObject *get_perf_sample_dict(st
                Py_FatalError("couldn't create Python dictionary");

        pydict_set_item_string_decref(dict, "ev_name", _PyUnicode_FromString(perf_evsel__name(evsel)));
-       pydict_set_item_string_decref(dict, "attr", _PyUnicode_FromStringAndSize(
-                       (const char *)&evsel->attr, sizeof(evsel->attr)));
+       pydict_set_item_string_decref(dict, "attr", _PyBytes_FromStringAndSize((const char *)&evsel->attr, sizeof(evsel->attr)));

        pydict_set_item_string_decref(dict_sample, "pid",
                        _PyLong_FromLong(sample->pid));

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py
  2019-01-19  1:12   ` Tony Jones
@ 2019-01-19  2:37     ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-19  2:37 UTC (permalink / raw)
  To: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/18/19 5:12 PM, Tony Jones wrote:
> On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
> 
>> +from __future__ import print_function
> 
> You don't need this unless you're actually requiring functionality that only exists in v3.
> For example, you need it to handle the suppress newline functionality such as "end=".

Also, it brings up a question I had.   What python versions are expected to be supported with PYTHON=python2?

https://python-future.org/imports.html   So importing from future (for end='' support) implies >= 2.6.   

The base release of 2.6 was October 2008 so maybe this is fine.  Otherwise it may be preferable to use sys.stdout.write which has more consistent semantics (see
tools/perf/scripts/python/compaction-times.py)

Tony

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py
  2019-01-19  0:45   ` Tony Jones
@ 2019-01-20 19:27     ` Jonathan Corbet
  2019-01-20 20:50       ` Tony Jones
  2019-01-21 10:45     ` seeteena
  1 sibling, 1 reply; 34+ messages in thread
From: Jonathan Corbet @ 2019-01-20 19:27 UTC (permalink / raw)
  To: Tony Jones
  Cc: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On Fri, 18 Jan 2019 16:45:04 -0800
Tony Jones <tonyj@suse.de> wrote:

> On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
> 
> > +if sys.version_info[0] < 3:
> > +    import cPickle
> > +else:
> > +    import _pickle as cPickle  
> 
> Do you really need this?
> 
> pickle is already in Python2.

Did you mean in Python3?  I would agree that using it is better than
importing the semi-hidden _pickle module.

That said, I'll echo the questions about testing.  Pickle works in
Python3, but it is fraught with all kinds of bytes/str and encoding
issues; I've found it sufficiently fragile in practice that I really just
try to avoid it.  How have you verified that this script works under both
versions of Python?

Thanks,

jon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py
  2019-01-20 19:27     ` Jonathan Corbet
@ 2019-01-20 20:50       ` Tony Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Jones @ 2019-01-20 20:50 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Seeteena Thoufeek, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, linux-kernel

On 1/20/19 11:27 AM, Jonathan Corbet wrote:
> On Fri, 18 Jan 2019 16:45:04 -0800
> Tony Jones <tonyj@suse.de> wrote:
> 
>> On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
>>
>>> +if sys.version_info[0] < 3:
>>> +    import cPickle
>>> +else:
>>> +    import _pickle as cPickle  
>>
>> Do you really need this?
>>
>> pickle is already in Python2.
> 
> Did you mean in Python3?  I would agree that using it is better than
> importing the semi-hidden _pickle module.

No.  I meant Python2 :)   

pickle in Python2 is the python implementation
cPickle in Python2 is the C implementation.

Read: https://docs.python.org/3.1/whatsnew/3.0.html#library-changes
A common pattern in Python 2.x is to have one version of a module implemented in pure Python, with an optional accelerated version implemented as a C extension; for example, pickle and cPickle. This places the burden of importing the accelerated version and falling back on the pure Python version on each user of these modules. In Python 3.0, the accelerated versions are considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python version. 

I my patchset "import pickle" was sufficient for Python2 and Python3  The question I suppose is whether this script,  for Python2,  needs the accelerated C implementation.  I decided it didn't.

Tony


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py
  2019-01-19  0:45   ` Tony Jones
  2019-01-20 19:27     ` Jonathan Corbet
@ 2019-01-21 10:45     ` seeteena
  1 sibling, 0 replies; 34+ messages in thread
From: seeteena @ 2019-01-21 10:45 UTC (permalink / raw)
  To: Tony Jones, peterz, mingo, acme, alexander.shishkin, jolsa,
	namhyung, linux-kernel



On 01/19/2019 06:15 AM, Tony Jones wrote:
> On 1/17/19 1:45 AM, Seeteena Thoufeek wrote:
>
>> +if sys.version_info[0] < 3:
>> +    import cPickle
>> +else:
>> +    import _pickle as cPickle
> Do you really need this?
>
> pickle is already in Python2.
>
> Also, did you test these changes on Python3?
>
> I think you'll find you also need the following hunk otherwise you're running into Unicode diffs on Py3.
>
> @@ -2590,8 +2590,8 @@ def Main():
>
>          is_sqlite3 = False
>          try:
> -               f = open(dbname)
> -               if f.read(15) == "SQLite format 3":
> +               f = open(dbname, "rb")
> +               if f.read(15) == b'SQLite format 3':
>                          is_sqlite3 = True
>                  f.close()
>          except:
>
> Plus you need to handle the conversion of "print >> sys.stderr"

Thanks Tony. added changes to handle the conversion of "print >> 
sys.stderr" in export-to-postgresql.py and export-to-sqlite.py file as 
well.  revised patch posted.
>
> Attached is my version (against tip):
>
> --- a/tools/perf/scripts/python/exported-sql-viewer.py
> +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> @@ -91,7 +91,7 @@ import sys
>   import weakref
>   import threading
>   import string
> -import cPickle
> +import pickle
>   import re
>   import os
>   from PySide.QtCore import *
> @@ -1559,7 +1559,7 @@ class SQLTableDialogDataItem():
>   					return str(lower_id)
>
>   	def ConvertRelativeTime(self, val):
> -		print "val ", val
> +		print("val ", val)
>   		mult = 1
>   		suffix = val[-2:]
>   		if suffix == "ms":
> @@ -1581,29 +1581,29 @@ class SQLTableDialogDataItem():
>   		return str(val)
>
>   	def ConvertTimeRange(self, vrange):
> -		print "vrange ", vrange
> +		print("vrange ", vrange)
>   		if vrange[0] == "":
>   			vrange[0] = str(self.first_time)
>   		if vrange[1] == "":
>   			vrange[1] = str(self.last_time)
>   		vrange[0] = self.ConvertRelativeTime(vrange[0])
>   		vrange[1] = self.ConvertRelativeTime(vrange[1])
> -		print "vrange2 ", vrange
> +		print("vrange2 ", vrange)
>   		if not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]):
>   			return False
> -		print "ok1"
> +		print("ok1")
>   		beg_range = max(int(vrange[0]), self.first_time)
>   		end_range = min(int(vrange[1]), self.last_time)
>   		if beg_range > self.last_time or end_range < self.first_time:
>   			return False
> -		print "ok2"
> +		print("ok2")
>   		vrange[0] = self.BinarySearchTime(0, self.last_id, beg_range, True)
>   		vrange[1] = self.BinarySearchTime(1, self.last_id + 1, end_range, False)
> -		print "vrange3 ", vrange
> +		print("vrange3 ", vrange)
>   		return True
>
>   	def AddTimeRange(self, value, ranges):
> -		print "value ", value
> +		print("value ", value)
>   		n = value.count("-")
>   		if n == 1:
>   			pass
> @@ -2577,7 +2577,7 @@ class DBRef():
>
>   def Main():
>   	if (len(sys.argv) < 2):
> -		print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}"
> +		sys.stderr.write("Usage is: exported-sql-viewer.py {<database name> | --help-only}\n");
>   		raise Exception("Too few arguments")
>
>   	dbname = sys.argv[1]
> @@ -2590,8 +2590,8 @@ def Main():
>
>   	is_sqlite3 = False
>   	try:
> -		f = open(dbname)
> -		if f.read(15) == "SQLite format 3":
> +		f = open(dbname, "rb")
> +		if f.read(15) == b'SQLite format 3':
>   			is_sqlite3 = True
>   		f.close()
>   	except:
>
>
>
>
>




^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2019-01-21 10:45 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17  9:45 [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to event_analyzing_sample.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to exported-sql-viewer.py Seeteena Thoufeek
2019-01-19  0:45   ` Tony Jones
2019-01-20 19:27     ` Jonathan Corbet
2019-01-20 20:50       ` Tony Jones
2019-01-21 10:45     ` seeteena
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-sqlite.py Seeteena Thoufeek
2019-01-19  1:05   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to failed-syscalls-by-pid.py Seeteena Thoufeek
2019-01-19  1:12   ` Tony Jones
2019-01-19  2:37     ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to futex-contention.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to intel-pt-events.py Seeteena Thoufeek
2019-01-19  1:16   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to mem-phys-addr.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to netdev-times.py Seeteena Thoufeek
2019-01-19  1:21   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to net_dropmonitor.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to powerpc-hcalls.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to sctop.py Seeteena Thoufeek
2019-01-19  1:27   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stackcollapse.py Seeteena Thoufeek
2019-01-19  1:46   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to stat-cpi.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py Seeteena Thoufeek
2019-01-19  0:53   ` Tony Jones
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts.py Seeteena Thoufeek
2019-01-17  9:45 ` [PATCH v2] perf scripts python: Add Python 3 support to export-to-postgresql.py Seeteena Thoufeek
2019-01-17 12:32 ` [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py Jiri Olsa
2019-01-17 13:23   ` Ravi Bangoria
2019-01-19  0:29   ` Tony Jones
2019-01-19  2:05     ` Tony Jones
2019-01-19  0:59 ` Tony Jones

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).