xref: /linux/include/trace/events/power.h (revision a234ca0faa65dcd5cc473915bd925130ebb7b74b)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM power
3 
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_POWER_H
6 
7 #include <linux/ktime.h>
8 #include <linux/tracepoint.h>
9 
10 #ifndef _TRACE_POWER_ENUM_
11 #define _TRACE_POWER_ENUM_
12 enum {
13 	POWER_NONE = 0,
14 	POWER_CSTATE = 1,
15 	POWER_PSTATE = 2,
16 };
17 #endif
18 
19 DECLARE_EVENT_CLASS(power,
20 
21 	TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
22 
23 	TP_ARGS(type, state, cpu_id),
24 
25 	TP_STRUCT__entry(
26 		__field(	u64,		type		)
27 		__field(	u64,		state		)
28 		__field(	u64,		cpu_id		)
29 	),
30 
31 	TP_fast_assign(
32 		__entry->type = type;
33 		__entry->state = state;
34 		__entry->cpu_id = cpu_id;
35 	),
36 
37 	TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
38 		(unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
39 );
40 
41 DEFINE_EVENT(power, power_start,
42 
43 	TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
44 
45 	TP_ARGS(type, state, cpu_id)
46 );
47 
48 DEFINE_EVENT(power, power_frequency,
49 
50 	TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
51 
52 	TP_ARGS(type, state, cpu_id)
53 );
54 
55 TRACE_EVENT(power_end,
56 
57 	TP_PROTO(unsigned int cpu_id),
58 
59 	TP_ARGS(cpu_id),
60 
61 	TP_STRUCT__entry(
62 		__field(	u64,		cpu_id		)
63 	),
64 
65 	TP_fast_assign(
66 		__entry->cpu_id = cpu_id;
67 	),
68 
69 	TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
70 
71 );
72 
73 #endif /* _TRACE_POWER_H */
74 
75 /* This part must be outside protection */
76 #include <trace/define_trace.h>
77