[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-770d2f86c0051d4f2c0ab9d74d68434cb383241d@git.kernel.org>
Date: Thu, 12 Jul 2018 06:58:21 -0700
From: tip-bot for Jeremy Cline <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, jeremy@...ine.org, hpa@...or.com,
herton@...hat.com, linux-kernel@...r.kernel.org,
namhyung@...nel.org, jolsa@...hat.com, peterz@...radead.org,
tglx@...utronix.de, alexander.shishkin@...ux.intel.com,
mingo@...nel.org
Subject: [tip:perf/urgent] perf scripts python: Add Python 3 support to
Core.py
Commit-ID: 770d2f86c0051d4f2c0ab9d74d68434cb383241d
Gitweb: https://git.kernel.org/tip/770d2f86c0051d4f2c0ab9d74d68434cb383241d
Author: Jeremy Cline <jeremy@...ine.org>
AuthorDate: Tue, 8 May 2018 21:27:45 +0000
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 11 Jul 2018 10:01:50 -0300
perf scripts python: Add Python 3 support to Core.py
Support both Python 2 and Python 3 in Core.py. This should have no
functional change.
Signed-off-by: Jeremy Cline <jeremy@...ine.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Herton Krzesinski <herton@...hat.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/0100016341a72ebe-e572899e-f445-4765-98f0-c314935727f9-000000@email.amazonses.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
.../python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 40 +++++++++-------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
index 38dfb720fb6f..54ace2f6bc36 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
+++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
@@ -31,10 +31,8 @@ def flag_str(event_name, field_name, value):
string = ""
if flag_fields[event_name][field_name]:
- print_delim = 0
- keys = flag_fields[event_name][field_name]['values'].keys()
- keys.sort()
- for idx in keys:
+ print_delim = 0
+ for idx in sorted(flag_fields[event_name][field_name]['values']):
if not value and not idx:
string += flag_fields[event_name][field_name]['values'][idx]
break
@@ -51,14 +49,12 @@ def symbol_str(event_name, field_name, value):
string = ""
if symbolic_fields[event_name][field_name]:
- keys = symbolic_fields[event_name][field_name]['values'].keys()
- keys.sort()
- for idx in keys:
+ for idx in sorted(symbolic_fields[event_name][field_name]['values']):
if not value and not idx:
- string = symbolic_fields[event_name][field_name]['values'][idx]
+ string = symbolic_fields[event_name][field_name]['values'][idx]
break
- if (value == idx):
- string = symbolic_fields[event_name][field_name]['values'][idx]
+ if (value == idx):
+ string = symbolic_fields[event_name][field_name]['values'][idx]
break
return string
@@ -74,19 +70,17 @@ def trace_flag_str(value):
string = ""
print_delim = 0
- keys = trace_flags.keys()
-
- for idx in keys:
- if not value and not idx:
- string += "NONE"
- break
-
- if idx and (value & idx) == idx:
- if print_delim:
- string += " | ";
- string += trace_flags[idx]
- print_delim = 1
- value &= ~idx
+ for idx in trace_flags:
+ if not value and not idx:
+ string += "NONE"
+ break
+
+ if idx and (value & idx) == idx:
+ if print_delim:
+ string += " | ";
+ string += trace_flags[idx]
+ print_delim = 1
+ value &= ~idx
return string
Powered by blists - more mailing lists