/tools/../Core.py: move tasks states outside the method
PATCH 1/1 /tools/../Core.py: move tasks states outside the method
The states variable is invariant for the taskState method. It could be brought out of the taskState.
Signed-off-by Alexander Pantyukhin <[email protected]>
--- .../Perf-Trace-Util/lib/Perf/Trace/Core.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py +8 -11
@@ -85,18 +85,15 @@ def trace_flag_str(value): return string -def taskState(state): - states = { - 0 : "R", - 1 : "S", - 2 : "D", - 64: "DEAD" - } - - if state not in states: - return "Unknown" +tasks_states = { + 0 : "R", + 1 : "S", + 2 : "D", + 64: "DEAD" +} - return states[state] +def taskState(state): + return tasks_states.get(state, "Unknown") class EventHeaders:
Signature · 1 line
2.25.1