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