lkml.org 
[lkml]   [2023]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] /tools/../Core.py: move tasks states outside the method
Date
The states variable is invariant for the taskState method. It could be
brought out of the taskState.

Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
---
.../Perf-Trace-Util/lib/Perf/Trace/Core.py | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 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 54ace2f6bc36..ecb5087e5583 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
@@ -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:
--
2.25.1
\
 
 \ /
  Last update: 2023-03-26 23:42    [W:0.037 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site