]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - include/trace/events/workqueue.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[thirdparty/kernel/linux.git] / include / trace / events / workqueue.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
e36c886a
AV
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM workqueue
4
5#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_WORKQUEUE_H
7
8#include <linux/tracepoint.h>
9#include <linux/workqueue.h>
10
97bd2347 11DECLARE_EVENT_CLASS(workqueue_work,
e36c886a
AV
12
13 TP_PROTO(struct work_struct *work),
14
15 TP_ARGS(work),
16
17 TP_STRUCT__entry(
18 __field( void *, work )
e36c886a
AV
19 ),
20
21 TP_fast_assign(
22 __entry->work = work;
e36c886a
AV
23 ),
24
97bd2347 25 TP_printk("work struct %p", __entry->work)
e36c886a
AV
26);
27
cdadf009
TH
28/**
29 * workqueue_queue_work - called when a work gets queued
30 * @req_cpu: the requested cpu
112202d9 31 * @pwq: pointer to struct pool_workqueue
cdadf009
TH
32 * @work: pointer to struct work_struct
33 *
34 * This event occurs when a work is queued immediately or once a
35 * delayed work is actually queued on a workqueue (ie: once the delay
36 * has been reached).
37 */
38TRACE_EVENT(workqueue_queue_work,
39
112202d9 40 TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
cdadf009
TH
41 struct work_struct *work),
42
112202d9 43 TP_ARGS(req_cpu, pwq, work),
cdadf009
TH
44
45 TP_STRUCT__entry(
46 __field( void *, work )
47 __field( void *, function)
48 __field( void *, workqueue)
49 __field( unsigned int, req_cpu )
50 __field( unsigned int, cpu )
51 ),
52
53 TP_fast_assign(
54 __entry->work = work;
55 __entry->function = work->func;
112202d9 56 __entry->workqueue = pwq->wq;
cdadf009 57 __entry->req_cpu = req_cpu;
112202d9 58 __entry->cpu = pwq->pool->cpu;
cdadf009
TH
59 ),
60
61 TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
62 __entry->work, __entry->function, __entry->workqueue,
63 __entry->req_cpu, __entry->cpu)
64);
65
66/**
67 * workqueue_activate_work - called when a work gets activated
68 * @work: pointer to struct work_struct
69 *
70 * This event occurs when a queued work is put on the active queue,
71 * which happens immediately after queueing unless @max_active limit
72 * is reached.
73 */
74DEFINE_EVENT(workqueue_work, workqueue_activate_work,
75
76 TP_PROTO(struct work_struct *work),
77
78 TP_ARGS(work)
79);
80
e36c886a 81/**
97bd2347 82 * workqueue_execute_start - called immediately before the workqueue callback
e36c886a
AV
83 * @work: pointer to struct work_struct
84 *
85 * Allows to track workqueue execution.
86 */
97bd2347 87TRACE_EVENT(workqueue_execute_start,
e36c886a
AV
88
89 TP_PROTO(struct work_struct *work),
90
91 TP_ARGS(work),
92
93 TP_STRUCT__entry(
94 __field( void *, work )
97bd2347 95 __field( void *, function)
e36c886a
AV
96 ),
97
98 TP_fast_assign(
99 __entry->work = work;
97bd2347 100 __entry->function = work->func;
e36c886a
AV
101 ),
102
97bd2347 103 TP_printk("work struct %p: function %pf", __entry->work, __entry->function)
e36c886a
AV
104);
105
97bd2347 106/**
b3aa1584 107 * workqueue_execute_end - called immediately after the workqueue callback
97bd2347
TH
108 * @work: pointer to struct work_struct
109 *
110 * Allows to track workqueue execution.
111 */
112DEFINE_EVENT(workqueue_work, workqueue_execute_end,
113
114 TP_PROTO(struct work_struct *work),
115
116 TP_ARGS(work)
117);
e36c886a
AV
118
119#endif /* _TRACE_WORKQUEUE_H */
120
121/* This part must be outside protection */
122#include <trace/define_trace.h>