File: wake_lock.py

package info (click to toggle)
pytimechart 1.0.0~rc1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 540 kB
  • sloc: python: 2,239; makefile: 77; sh: 60
file content (28 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from timechart.plugin import *
from timechart import colors
from timechart.model import tcProcess

class wake_lock(plugin):
    additional_colors = """
wakelock_bg        	#D6F09D
"""
    additional_ftrace_parsers = [
        ('wakelock_lock',   'name=%s type=%d', 'name', 'type'),
        ('wakelock_unlock',   'name=%s', 'name'),
        ]
    additional_process_types = {
        "wakelock":(tcProcess, POWER_CLASS),
        }
    @staticmethod
    def do_event_wakelock_lock(proj,event):
        process = proj.generic_find_process(0,"wakelock:%s"%(event.name),"wakelock")
        proj.generic_process_start(process,event,False)
        proj.wake_events.append(((event.common_comm,event.common_pid),(process['comm'],process['pid']),event.timestamp))

    @staticmethod
    def do_event_wakelock_unlock(proj,event):
        process = proj.generic_find_process(0,"wakelock:%s"%(event.name),"wakelock")
        proj.generic_process_end(process,event,False)
        proj.wake_events.append(((event.common_comm,event.common_pid),(process['comm'],process['pid']),event.timestamp))
plugin_register(wake_lock)