Commit 770d2f86 authored by Jeremy Cline's avatar Jeremy Cline Committed by Arnaldo Carvalho de Melo

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: default avatarJeremy Cline <jeremy@jcline.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Herton Krzesinski <herton@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/0100016341a72ebe-e572899e-f445-4765-98f0-c314935727f9-000000@email.amazonses.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 877cc639
...@@ -31,10 +31,8 @@ def flag_str(event_name, field_name, value): ...@@ -31,10 +31,8 @@ def flag_str(event_name, field_name, value):
string = "" string = ""
if flag_fields[event_name][field_name]: if flag_fields[event_name][field_name]:
print_delim = 0 print_delim = 0
keys = flag_fields[event_name][field_name]['values'].keys() for idx in sorted(flag_fields[event_name][field_name]['values']):
keys.sort()
for idx in keys:
if not value and not idx: if not value and not idx:
string += flag_fields[event_name][field_name]['values'][idx] string += flag_fields[event_name][field_name]['values'][idx]
break break
...@@ -51,14 +49,12 @@ def symbol_str(event_name, field_name, value): ...@@ -51,14 +49,12 @@ def symbol_str(event_name, field_name, value):
string = "" string = ""
if symbolic_fields[event_name][field_name]: if symbolic_fields[event_name][field_name]:
keys = symbolic_fields[event_name][field_name]['values'].keys() for idx in sorted(symbolic_fields[event_name][field_name]['values']):
keys.sort()
for idx in keys:
if not value and not idx: 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 break
if (value == idx): if (value == idx):
string = symbolic_fields[event_name][field_name]['values'][idx] string = symbolic_fields[event_name][field_name]['values'][idx]
break break
return string return string
...@@ -74,19 +70,17 @@ def trace_flag_str(value): ...@@ -74,19 +70,17 @@ def trace_flag_str(value):
string = "" string = ""
print_delim = 0 print_delim = 0
keys = trace_flags.keys() for idx in trace_flags:
if not value and not idx:
for idx in keys: string += "NONE"
if not value and not idx: break
string += "NONE"
break if idx and (value & idx) == idx:
if print_delim:
if idx and (value & idx) == idx: string += " | ";
if print_delim: string += trace_flags[idx]
string += " | "; print_delim = 1
string += trace_flags[idx] value &= ~idx
print_delim = 1
value &= ~idx
return string return string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment