power: supply: bq24190_charger: Add disable-reset device-property
[linux/fpc-iii.git] / tools / perf / python / tracepoint.py
blobeb4dbed57de7ea15a243a22be175d6716a97ec75
1 #! /usr/bin/python
2 # -*- python -*-
3 # -*- coding: utf-8 -*-
5 import perf
7 class tracepoint(perf.evsel):
8 def __init__(self, sys, name):
9 config = perf.tracepoint(sys, name)
10 perf.evsel.__init__(self,
11 type = perf.TYPE_TRACEPOINT,
12 config = config,
13 freq = 0, sample_period = 1, wakeup_events = 1,
14 sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU | perf.SAMPLE_RAW | perf.SAMPLE_TIME)
16 def main():
17 tp = tracepoint("sched", "sched_switch")
18 cpus = perf.cpu_map()
19 threads = perf.thread_map(-1)
21 evlist = perf.evlist(cpus, threads)
22 evlist.add(tp)
23 evlist.open()
24 evlist.mmap()
26 while True:
27 evlist.poll(timeout = -1)
28 for cpu in cpus:
29 event = evlist.read_on_cpu(cpu)
30 if not event:
31 continue
33 if not isinstance(event, perf.sample_event):
34 continue
36 print "time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
37 event.sample_time,
38 event.prev_comm,
39 event.prev_pid,
40 event.prev_prio,
41 event.prev_state,
42 event.next_comm,
43 event.next_pid,
44 event.next_prio)
46 if __name__ == '__main__':
47 main()