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