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 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
b87700e3 AG |
9 | #include <linux/workqueue.h> |
10 | #include <linux/version.h> | |
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 | ||
b87700e3 AG |
31 | /** |
32 | * workqueue_queue_work - called when a work gets queued | |
33 | * @req_cpu: the requested cpu | |
34 | * @cwq: pointer to struct cpu_workqueue_struct | |
35 | * @work: pointer to struct work_struct | |
36 | * | |
37 | * This event occurs when a work is queued immediately or once a | |
38 | * delayed work is actually queued on a workqueue (ie: once the delay | |
39 | * has been reached). | |
40 | */ | |
3bc29f0a | 41 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
b87700e3 | 42 | |
20008d8c MD |
43 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
44 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, | |
45 | struct work_struct *work), | |
46 | ||
47 | TP_ARGS(req_cpu, pwq, work), | |
48 | #else | |
b87700e3 AG |
49 | TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq, |
50 | struct work_struct *work), | |
51 | ||
52 | TP_ARGS(req_cpu, cwq, work), | |
20008d8c | 53 | #endif |
b87700e3 | 54 | |
f127e61e | 55 | TP_FIELDS( |
fa91fcac MD |
56 | ctf_integer_hex(void *, work, work) |
57 | ctf_integer_hex(void *, function, work->func) | |
f127e61e MD |
58 | ctf_integer(unsigned int, req_cpu, req_cpu) |
59 | ) | |
b87700e3 AG |
60 | ) |
61 | ||
62 | /** | |
63 | * workqueue_activate_work - called when a work gets activated | |
64 | * @work: pointer to struct work_struct | |
65 | * | |
66 | * This event occurs when a queued work is put on the active queue, | |
67 | * which happens immediately after queueing unless @max_active limit | |
68 | * is reached. | |
69 | */ | |
3bc29f0a | 70 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
b87700e3 AG |
71 | |
72 | TP_PROTO(struct work_struct *work), | |
73 | ||
74 | TP_ARGS(work) | |
75 | ) | |
b87700e3 AG |
76 | |
77 | /** | |
78 | * workqueue_execute_start - called immediately before the workqueue callback | |
79 | * @work: pointer to struct work_struct | |
80 | * | |
81 | * Allows to track workqueue execution. | |
82 | */ | |
3bc29f0a | 83 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
b87700e3 AG |
84 | |
85 | TP_PROTO(struct work_struct *work), | |
86 | ||
87 | TP_ARGS(work), | |
88 | ||
f127e61e | 89 | TP_FIELDS( |
fa91fcac MD |
90 | ctf_integer_hex(void *, work, work) |
91 | ctf_integer_hex(void *, function, work->func) | |
f127e61e | 92 | ) |
b87700e3 AG |
93 | ) |
94 | ||
5322beb1 MJ |
95 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) |
96 | /** | |
97 | * workqueue_execute_end - called immediately after the workqueue callback | |
98 | * @work: pointer to struct work_struct | |
99 | * @function: pointer to worker function | |
100 | * | |
101 | * Allows to track workqueue execution. | |
102 | */ | |
103 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, | |
104 | ||
105 | TP_PROTO(struct work_struct *work, work_func_t function), | |
106 | ||
107 | TP_ARGS(work, function), | |
108 | ||
109 | TP_FIELDS( | |
110 | ctf_integer_hex(void *, work, work) | |
111 | ctf_integer_hex(void *, function, function) | |
112 | ) | |
113 | ) | |
114 | #else | |
b87700e3 AG |
115 | /** |
116 | * workqueue_execute_end - called immediately after the workqueue callback | |
117 | * @work: pointer to struct work_struct | |
118 | * | |
119 | * Allows to track workqueue execution. | |
120 | */ | |
3bc29f0a | 121 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, |
b87700e3 AG |
122 | |
123 | TP_PROTO(struct work_struct *work), | |
124 | ||
125 | TP_ARGS(work) | |
126 | ) | |
5322beb1 | 127 | #endif |
b87700e3 | 128 | |
3bc29f0a | 129 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
b87700e3 AG |
130 | |
131 | /* This part must be outside protection */ | |
6ec43db8 | 132 | #include <probes/define_trace.h> |