[pytimechart] new cpuidle tracepoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have started to use the new cpuidle tracepoint and created a plugin
for pytimechart.
I'm not sure if it's the right way to add this cpuidle trace format
update but it's the less intrusive one.

I also have a plugin for new cpu_hotplug trace points but i'm waiting
for trace approval before sending it

Vincent

Subject: [PATCH 1/1] cpuidle: new plugin
  new tracepoints are available for cpuidle


Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
---
 timechart/plugins/cpuidle.py |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 timechart/plugins/cpuidle.py

diff --git a/timechart/plugins/cpuidle.py b/timechart/plugins/cpuidle.py
new file mode 100644
index 0000000..32dce91
--- /dev/null
+++ b/timechart/plugins/cpuidle.py
@@ -0,0 +1,35 @@
+from timechart.plugin import *
+from timechart import colors
+from timechart.model import tcProcess, c_state_table
+
+class cpu_idle(plugin):
+    additional_colors = """
+"""
+    additional_ftrace_parsers = [
+        ('cpu_idle',  'state=%d cpu_id=%d', 'state', 'cpuid'),
+        ]
+
+    additional_process_types = {
+        }
+
+    @staticmethod
+    def do_event_cpu_idle(self,event):
+        self.ensure_cpu_allocated(event.cpuid)
+        tc = self.tmp_c_states[event.cpuid]
+        if event.state != 4294967295 :
+            if len(tc['start_ts'])>len(tc['end_ts']):
+                tc['end_ts'].append(event.timestamp)
+                self.missed_power_end +=1
+                if self.missed_power_end < 10:
+                    print "warning: missed cpu_idle end"
+                if self.missed_power_end == 10:
+                    print "warning: missed cpu_idle end: wont warn anymore!"
+            tc['start_ts'].append(event.timestamp)
+            tc['types'].append(colors.get_color_id(c_state_table[int(event.state)]))
+            tc['linenumbers'].append(event.linenumber)
+        else :
+            if len(tc['start_ts'])>len(tc['end_ts']):
+                tc['end_ts'].append(event.timestamp)
+
+plugin_register(cpu_idle)
+
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux