| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM workqueue |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_WORKQUEUE_H |
| 7 | |
| 8 | #include <probes/lttng-tracepoint-event.h> |
| 9 | #include <linux/workqueue.h> |
| 10 | |
| 11 | #ifndef _TRACE_WORKQUEUE_DEF_ |
| 12 | #define _TRACE_WORKQUEUE_DEF_ |
| 13 | |
| 14 | struct worker; |
| 15 | struct global_cwq; |
| 16 | |
| 17 | #endif |
| 18 | |
| 19 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, |
| 20 | |
| 21 | TP_PROTO(struct work_struct *work), |
| 22 | |
| 23 | TP_ARGS(work), |
| 24 | |
| 25 | TP_FIELDS( |
| 26 | ctf_integer_hex(void *, work, work) |
| 27 | ) |
| 28 | ) |
| 29 | |
| 30 | /** |
| 31 | * workqueue_queue_work - called when a work gets queued |
| 32 | * @req_cpu: the requested cpu |
| 33 | * @cwq: pointer to struct cpu_workqueue_struct |
| 34 | * @work: pointer to struct work_struct |
| 35 | * |
| 36 | * This event occurs when a work is queued immediately or once a |
| 37 | * delayed work is actually queued on a workqueue (ie: once the delay |
| 38 | * has been reached). |
| 39 | */ |
| 40 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
| 41 | |
| 42 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, |
| 43 | struct work_struct *work), |
| 44 | |
| 45 | TP_ARGS(req_cpu, pwq, work), |
| 46 | |
| 47 | TP_FIELDS( |
| 48 | ctf_integer_hex(void *, work, work) |
| 49 | ctf_integer_hex(void *, function, work->func) |
| 50 | ctf_integer(unsigned int, req_cpu, req_cpu) |
| 51 | ) |
| 52 | ) |
| 53 | |
| 54 | /** |
| 55 | * workqueue_activate_work - called when a work gets activated |
| 56 | * @work: pointer to struct work_struct |
| 57 | * |
| 58 | * This event occurs when a queued work is put on the active queue, |
| 59 | * which happens immediately after queueing unless @max_active limit |
| 60 | * is reached. |
| 61 | */ |
| 62 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
| 63 | |
| 64 | TP_PROTO(struct work_struct *work), |
| 65 | |
| 66 | TP_ARGS(work) |
| 67 | ) |
| 68 | |
| 69 | /** |
| 70 | * workqueue_execute_start - called immediately before the workqueue callback |
| 71 | * @work: pointer to struct work_struct |
| 72 | * |
| 73 | * Allows to track workqueue execution. |
| 74 | */ |
| 75 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
| 76 | |
| 77 | TP_PROTO(struct work_struct *work), |
| 78 | |
| 79 | TP_ARGS(work), |
| 80 | |
| 81 | TP_FIELDS( |
| 82 | ctf_integer_hex(void *, work, work) |
| 83 | ctf_integer_hex(void *, function, work->func) |
| 84 | ) |
| 85 | ) |
| 86 | |
| 87 | /** |
| 88 | * workqueue_execute_end - called immediately after the workqueue callback |
| 89 | * @work: pointer to struct work_struct |
| 90 | * @function: pointer to worker function |
| 91 | * |
| 92 | * Allows to track workqueue execution. |
| 93 | */ |
| 94 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, |
| 95 | |
| 96 | TP_PROTO(struct work_struct *work, work_func_t function), |
| 97 | |
| 98 | TP_ARGS(work, function), |
| 99 | |
| 100 | TP_FIELDS( |
| 101 | ctf_integer_hex(void *, work, work) |
| 102 | ctf_integer_hex(void *, function, function) |
| 103 | ) |
| 104 | ) |
| 105 | |
| 106 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
| 107 | |
| 108 | /* This part must be outside protection */ |
| 109 | #include <probes/define_trace.h> |