]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
perf, sched migration: Librarize task states and event headers helpers
authorFrederic Weisbecker <fweisbec@gmail.com>
Sun, 1 Aug 2010 12:55:45 +0000 (14:55 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Sun, 1 Aug 2010 23:32:00 +0000 (01:32 +0200)
Librarize the task state and event headers helpers as they can
be generally useful.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Nikhil Rao <ncrao@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
tools/perf/scripts/python/sched-migration.py

index 1dc464ee2ca8817042107f1cd222ef22e3f79460..aad7525bca1dc5a45ca72cd4be79eec7411a2bb0 100644 (file)
@@ -89,3 +89,33 @@ def trace_flag_str(value):
            value &= ~idx
 
     return string
+
+
+def taskState(state):
+       states = {
+               0 : "R",
+               1 : "S",
+               2 : "D",
+               64: "DEAD"
+       }
+
+       if state not in states:
+               return "Unknown"
+
+       return states[state]
+
+
+class EventHeaders:
+       def __init__(self, common_cpu, common_secs, common_nsecs,
+                    common_pid, common_comm):
+               self.cpu = common_cpu
+               self.secs = common_secs
+               self.nsecs = common_nsecs
+               self.pid = common_pid
+               self.comm = common_comm
+
+       def ts(self):
+               return (self.secs * (10 ** 9)) + self.nsecs
+
+       def ts_format(self):
+               return "%d.%d" % (self.secs, int(self.nsecs / 1000))
index 983463050f046d23fc498dd3d1b5f604bec857e9..b934383c3364e63ed7bd6147bf5509867c65e7e2 100644 (file)
@@ -31,36 +31,6 @@ threads = { 0 : "idle"}
 def thread_name(pid):
        return "%s:%d" % (threads[pid], pid)
 
-class EventHeaders:
-       def __init__(self, common_cpu, common_secs, common_nsecs,
-                    common_pid, common_comm):
-               self.cpu = common_cpu
-               self.secs = common_secs
-               self.nsecs = common_nsecs
-               self.pid = common_pid
-               self.comm = common_comm
-
-       def ts(self):
-               return (self.secs * (10 ** 9)) + self.nsecs
-
-       def ts_format(self):
-               return "%d.%d" % (self.secs, int(self.nsecs / 1000))
-
-
-def taskState(state):
-       states = {
-               0 : "R",
-               1 : "S",
-               2 : "D",
-               64: "DEAD"
-       }
-
-       if state not in states:
-               return "Unknown"
-
-       return states[state]
-
-
 class RunqueueEventUnknown:
        @staticmethod
        def color():