Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b87700e3 AG |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM workqueue | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_WORKQUEUE_H | |
b87700e3 | 7 | |
3b4aafcb | 8 | #include <lttng/tracepoint-event.h> |
b87700e3 | 9 | #include <linux/workqueue.h> |
5f4c791e | 10 | #include <lttng/kernel-version.h> |
b87700e3 | 11 | |
b87700e3 AG |
12 | #ifndef _TRACE_WORKQUEUE_DEF_ |
13 | #define _TRACE_WORKQUEUE_DEF_ | |
14 | ||
15 | struct worker; | |
16 | struct global_cwq; | |
17 | ||
b87700e3 AG |
18 | #endif |
19 | ||
3bc29f0a | 20 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, |
b87700e3 AG |
21 | |
22 | TP_PROTO(struct work_struct *work), | |
23 | ||
24 | TP_ARGS(work), | |
25 | ||
f127e61e | 26 | TP_FIELDS( |
fa91fcac | 27 | ctf_integer_hex(void *, work, work) |
f127e61e | 28 | ) |
b87700e3 AG |
29 | ) |
30 | ||
c6da9604 | 31 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0)) |
b87700e3 AG |
32 | /** |
33 | * workqueue_queue_work - called when a work gets queued | |
34 | * @req_cpu: the requested cpu | |
c6da9604 MJ |
35 | * @pwq: pointer to struct pool_workqueue |
36 | * @work: pointer to struct work_struct | |
37 | * | |
38 | * This event occurs when a work is queued immediately or once a | |
39 | * delayed work is actually queued on a workqueue (ie: once the delay | |
40 | * has been reached). | |
41 | */ | |
42 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, | |
43 | ||
44 | TP_PROTO(int req_cpu, struct pool_workqueue *pwq, | |
45 | struct work_struct *work), | |
46 | ||
47 | TP_ARGS(req_cpu, pwq, work), | |
48 | ||
49 | TP_FIELDS( | |
50 | ctf_integer_hex(void *, work, work) | |
51 | ctf_integer_hex(void *, function, work->func) | |
52 | ctf_integer(int, req_cpu, req_cpu) | |
53 | ) | |
54 | ) | |
20ae8594 | 55 | #else |
c6da9604 MJ |
56 | /** |
57 | * workqueue_queue_work - called when a work gets queued | |
58 | * @req_cpu: the requested cpu | |
59 | * @pwq: pointer to struct pool_workqueue | |
b87700e3 AG |
60 | * @work: pointer to struct work_struct |
61 | * | |
62 | * This event occurs when a work is queued immediately or once a | |
63 | * delayed work is actually queued on a workqueue (ie: once the delay | |
64 | * has been reached). | |
65 | */ | |
3bc29f0a | 66 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
b87700e3 | 67 | |
20008d8c MD |
68 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, |
69 | struct work_struct *work), | |
70 | ||
71 | TP_ARGS(req_cpu, pwq, work), | |
c6da9604 MJ |
72 | |
73 | TP_FIELDS( | |
74 | ctf_integer_hex(void *, work, work) | |
75 | ctf_integer_hex(void *, function, work->func) | |
76 | ctf_integer(unsigned int, req_cpu, req_cpu) | |
77 | ) | |
78 | ) | |
c6da9604 | 79 | #endif |
b87700e3 AG |
80 | |
81 | /** | |
82 | * workqueue_activate_work - called when a work gets activated | |
83 | * @work: pointer to struct work_struct | |
84 | * | |
85 | * This event occurs when a queued work is put on the active queue, | |
86 | * which happens immediately after queueing unless @max_active limit | |
87 | * is reached. | |
88 | */ | |
3bc29f0a | 89 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
b87700e3 AG |
90 | |
91 | TP_PROTO(struct work_struct *work), | |
92 | ||
93 | TP_ARGS(work) | |
94 | ) | |
b87700e3 AG |
95 | |
96 | /** | |
97 | * workqueue_execute_start - called immediately before the workqueue callback | |
98 | * @work: pointer to struct work_struct | |
99 | * | |
100 | * Allows to track workqueue execution. | |
101 | */ | |
3bc29f0a | 102 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
b87700e3 AG |
103 | |
104 | TP_PROTO(struct work_struct *work), | |
105 | ||
106 | TP_ARGS(work), | |
107 | ||
f127e61e | 108 | TP_FIELDS( |
fa91fcac MD |
109 | ctf_integer_hex(void *, work, work) |
110 | ctf_integer_hex(void *, function, work->func) | |
f127e61e | 111 | ) |
b87700e3 AG |
112 | ) |
113 | ||
5f4c791e | 114 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
5322beb1 MJ |
115 | /** |
116 | * workqueue_execute_end - called immediately after the workqueue callback | |
117 | * @work: pointer to struct work_struct | |
118 | * @function: pointer to worker function | |
119 | * | |
120 | * Allows to track workqueue execution. | |
121 | */ | |
122 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, | |
123 | ||
124 | TP_PROTO(struct work_struct *work, work_func_t function), | |
125 | ||
126 | TP_ARGS(work, function), | |
127 | ||
128 | TP_FIELDS( | |
129 | ctf_integer_hex(void *, work, work) | |
130 | ctf_integer_hex(void *, function, function) | |
131 | ) | |
132 | ) | |
133 | #else | |
b87700e3 AG |
134 | /** |
135 | * workqueue_execute_end - called immediately after the workqueue callback | |
136 | * @work: pointer to struct work_struct | |
137 | * | |
138 | * Allows to track workqueue execution. | |
139 | */ | |
3bc29f0a | 140 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, |
b87700e3 AG |
141 | |
142 | TP_PROTO(struct work_struct *work), | |
143 | ||
144 | TP_ARGS(work) | |
145 | ) | |
5322beb1 | 146 | #endif |
b87700e3 | 147 | |
3bc29f0a | 148 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
b87700e3 AG |
149 | |
150 | /* This part must be outside protection */ | |
3b4aafcb | 151 | #include <lttng/define_trace.h> |