blob: 33f85b68c22c13b0a4492d2b81e180edd837886a [file] [log] [blame]
Ming Lei53b615c2011-09-27 22:53:27 +02001
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM rpm
4
5#if !defined(_TRACE_RUNTIME_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_RUNTIME_POWER_H
7
8#include <linux/ktime.h>
9#include <linux/tracepoint.h>
Paul Gortmaker313162d2012-01-30 11:46:54 -050010
11struct device;
Ming Lei53b615c2011-09-27 22:53:27 +020012
13/*
14 * The rpm_internal events are used for tracing some important
15 * runtime pm internal functions.
16 */
17DECLARE_EVENT_CLASS(rpm_internal,
18
19 TP_PROTO(struct device *dev, int flags),
20
21 TP_ARGS(dev, flags),
22
23 TP_STRUCT__entry(
24 __string( name, dev_name(dev) )
25 __field( int, flags )
26 __field( int , usage_count )
27 __field( int , disable_depth )
28 __field( int , runtime_auto )
29 __field( int , request_pending )
30 __field( int , irq_safe )
31 __field( int , child_count )
32 ),
33
34 TP_fast_assign(
35 __assign_str(name, dev_name(dev));
36 __entry->flags = flags;
37 __entry->usage_count = atomic_read(
38 &dev->power.usage_count);
39 __entry->disable_depth = dev->power.disable_depth;
40 __entry->runtime_auto = dev->power.runtime_auto;
41 __entry->request_pending = dev->power.request_pending;
42 __entry->irq_safe = dev->power.irq_safe;
43 __entry->child_count = atomic_read(
44 &dev->power.child_count);
45 ),
46
47 TP_printk("%s flags-%x cnt-%-2d dep-%-2d auto-%-1d p-%-1d"
48 " irq-%-1d child-%d",
49 __get_str(name), __entry->flags,
50 __entry->usage_count,
51 __entry->disable_depth,
52 __entry->runtime_auto,
53 __entry->request_pending,
54 __entry->irq_safe,
55 __entry->child_count
56 )
57);
58DEFINE_EVENT(rpm_internal, rpm_suspend,
59
60 TP_PROTO(struct device *dev, int flags),
61
62 TP_ARGS(dev, flags)
63);
64DEFINE_EVENT(rpm_internal, rpm_resume,
65
66 TP_PROTO(struct device *dev, int flags),
67
68 TP_ARGS(dev, flags)
69);
70DEFINE_EVENT(rpm_internal, rpm_idle,
71
72 TP_PROTO(struct device *dev, int flags),
73
74 TP_ARGS(dev, flags)
75);
76
77TRACE_EVENT(rpm_return_int,
78 TP_PROTO(struct device *dev, unsigned long ip, int ret),
79 TP_ARGS(dev, ip, ret),
80
81 TP_STRUCT__entry(
82 __string( name, dev_name(dev))
83 __field( unsigned long, ip )
84 __field( int, ret )
85 ),
86
87 TP_fast_assign(
88 __assign_str(name, dev_name(dev));
89 __entry->ip = ip;
90 __entry->ret = ret;
91 ),
92
93 TP_printk("%pS:%s ret=%d", (void *)__entry->ip, __get_str(name),
94 __entry->ret)
95);
96
97#endif /* _TRACE_RUNTIME_POWER_H */
98
99/* This part must be outside protection */
100#include <trace/define_trace.h>