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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
#undef TRACE_SYSTEM
#define TRACE_SYSTEM power
#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_POWER_H
#include <linux/ktime.h>
#include <linux/pm_qos.h>
#include <linux/tracepoint.h>
DECLARE_EVENT_CLASS(cpu,
TP_PROTO(unsigned int state, unsigned int cpu_id),
TP_ARGS(state, cpu_id),
TP_STRUCT__entry(
__field( u32, state )
__field( u32, cpu_id )
),
TP_fast_assign(
__entry->state = state;
__entry->cpu_id = cpu_id;
),
TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
(unsigned long)__entry->cpu_id)
);
DEFINE_EVENT(cpu, cpu_idle,
TP_PROTO(unsigned int state, unsigned int cpu_id),
TP_ARGS(state, cpu_id)
);
/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
#define _PWR_EVENT_AVOID_DOUBLE_DEFINING
#define PWR_EVENT_EXIT -1
#endif
DEFINE_EVENT(cpu, cpu_frequency,
TP_PROTO(unsigned int frequency, unsigned int cpu_id),
TP_ARGS(frequency, cpu_id)
);
TRACE_EVENT(machine_suspend,
TP_PROTO(unsigned int state),
TP_ARGS(state),
TP_STRUCT__entry(
__field( u32, state )
),
TP_fast_assign(
__entry->state = state;
),
TP_printk("state=%lu", (unsigned long)__entry->state)
);
TRACE_EVENT(device_pm_report_time,
TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time,
char *pm_event_str, int error),
TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error),
TP_STRUCT__entry(
__string(device, dev_name(dev))
__string(driver, dev_driver_string(dev))
__string(parent, dev->parent ? dev_name(dev->parent) : "none")
__string(pm_ops, pm_ops ? pm_ops : "none ")
__string(pm_event_str, pm_event_str)
__field(s64, ops_time)
__field(int, error)
),
TP_fast_assign(
const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
const char *tmp_i = pm_ops ? pm_ops : "none ";
__assign_str(device, dev_name(dev));
__assign_str(driver, dev_driver_string(dev));
__assign_str(parent, tmp);
__assign_str(pm_ops, tmp_i);
__assign_str(pm_event_str, pm_event_str);
__entry->ops_time = ops_time;
__entry->error = error;
),
/* ops_str has an extra space at the end */
TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d",
__get_str(driver), __get_str(device), __get_str(parent),
__get_str(pm_event_str), __get_str(pm_ops),
__entry->ops_time, __entry->error)
);
DECLARE_EVENT_CLASS(wakeup_source,
TP_PROTO(const char *name, unsigned int state),
TP_ARGS(name, state),
TP_STRUCT__entry(
__string( name, name )
__field( u64, state )
),
TP_fast_assign(
__assign_str(name, name);
__entry->state = state;
),
TP_printk("%s state=0x%lx", __get_str(name),
(unsigned long)__entry->state)
);
DEFINE_EVENT(wakeup_source, wakeup_source_activate,
TP_PROTO(const char *name, unsigned int state),
TP_ARGS(name, state)
);
DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
TP_PROTO(const char *name, unsigned int state),
TP_ARGS(name, state)
);
/*
* The clock events are used for clock enable/disable and for
* clock rate change
*/
DECLARE_EVENT_CLASS(clock,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id),
TP_STRUCT__entry(
__string( name, name )
__field( u64, state )
__field( u64, cpu_id )
),
TP_fast_assign(
__assign_str(name, name);
__entry->state = state;
__entry->cpu_id = cpu_id;
),
TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
(unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
);
DEFINE_EVENT(clock, clock_enable,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id)
);
DEFINE_EVENT(clock, clock_disable,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id)
);
DEFINE_EVENT(clock, clock_set_rate,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id)
);
/*
* The power domain events are used for power domains transitions
*/
DECLARE_EVENT_CLASS(power_domain,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id),
TP_STRUCT__entry(
__string( name, name )
__field( u64, state )
__field( u64, cpu_id )
),
TP_fast_assign(
__assign_str(name, name);
__entry->state = state;
__entry->cpu_id = cpu_id;
),
TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
(unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
);
DEFINE_EVENT(power_domain, power_domain_target,
TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
TP_ARGS(name, state, cpu_id)
);
/*
* The pm qos events are used for pm qos update
*/
DECLARE_EVENT_CLASS(pm_qos_request,
TP_PROTO(int pm_qos_class, s32 value),
TP_ARGS(pm_qos_class, value),
TP_STRUCT__entry(
__field( int, pm_qos_class )
__field( s32, value )
),
TP_fast_assign(
__entry->pm_qos_class = pm_qos_class;
__entry->value = value;
),
TP_printk("pm_qos_class=%s value=%d",
__print_symbolic(__entry->pm_qos_class,
{ PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
{ PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
{ PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
__entry->value)
);
DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
TP_PROTO(int pm_qos_class, s32 value),
TP_ARGS(pm_qos_class, value)
);
DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
TP_PROTO(int pm_qos_class, s32 value),
TP_ARGS(pm_qos_class, value)
);
DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
TP_PROTO(int pm_qos_class, s32 value),
TP_ARGS(pm_qos_class, value)
);
TRACE_EVENT(pm_qos_update_request_timeout,
TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
TP_ARGS(pm_qos_class, value, timeout_us),
TP_STRUCT__entry(
__field( int, pm_qos_class )
__field( s32, value )
__field( unsigned long, timeout_us )
),
TP_fast_assign(
__entry->pm_qos_class = pm_qos_class;
__entry->value = value;
__entry->timeout_us = timeout_us;
),
TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
__print_symbolic(__entry->pm_qos_class,
{ PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
{ PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
{ PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
__entry->value, __entry->timeout_us)
);
DECLARE_EVENT_CLASS(pm_qos_update,
TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
TP_ARGS(action, prev_value, curr_value),
TP_STRUCT__entry(
__field( enum pm_qos_req_action, action )
__field( int, prev_value )
__field( int, curr_value )
),
TP_fast_assign(
__entry->action = action;
__entry->prev_value = prev_value;
__entry->curr_value = curr_value;
),
TP_printk("action=%s prev_value=%d curr_value=%d",
__print_symbolic(__entry->action,
{ PM_QOS_ADD_REQ, "ADD_REQ" },
{ PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
{ PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
__entry->prev_value, __entry->curr_value)
);
DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
TP_ARGS(action, prev_value, curr_value)
);
DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
TP_ARGS(action, prev_value, curr_value),
TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
__print_symbolic(__entry->action,
{ PM_QOS_ADD_REQ, "ADD_REQ" },
{ PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
{ PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
__entry->prev_value, __entry->curr_value)
);
DECLARE_EVENT_CLASS(dev_pm_qos_request,
TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
s32 new_value),
TP_ARGS(name, type, new_value),
TP_STRUCT__entry(
__string( name, name )
__field( enum dev_pm_qos_req_type, type )
__field( s32, new_value )
),
TP_fast_assign(
__assign_str(name, name);
__entry->type = type;
__entry->new_value = new_value;
),
TP_printk("device=%s type=%s new_value=%d",
__get_str(name),
__print_symbolic(__entry->type,
{ DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" },
{ DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
__entry->new_value)
);
DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
s32 new_value),
TP_ARGS(name, type, new_value)
);
DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
s32 new_value),
TP_ARGS(name, type, new_value)
);
DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
s32 new_value),
TP_ARGS(name, type, new_value)
);
#endif /* _TRACE_POWER_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
|