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@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.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
877cc63968
Коммит
770d2f86c0
|
@ -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 trace_flags:
|
||||
if not value and not idx:
|
||||
string += "NONE"
|
||||
break
|
||||
|
||||
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
|
||||
if idx and (value & idx) == idx:
|
||||
if print_delim:
|
||||
string += " | ";
|
||||
string += trace_flags[idx]
|
||||
print_delim = 1
|
||||
value &= ~idx
|
||||
|
||||
return string
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче