Loading...
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM workqueue
3
4#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WORKQUEUE_H
6
7#include <linux/tracepoint.h>
8#include <linux/workqueue.h>
9
10DECLARE_EVENT_CLASS(workqueue_work,
11
12 TP_PROTO(struct work_struct *work),
13
14 TP_ARGS(work),
15
16 TP_STRUCT__entry(
17 __field( void *, work )
18 ),
19
20 TP_fast_assign(
21 __entry->work = work;
22 ),
23
24 TP_printk("work struct %p", __entry->work)
25);
26
27/**
28 * workqueue_queue_work - called when a work gets queued
29 * @req_cpu: the requested cpu
30 * @cwq: pointer to struct cpu_workqueue_struct
31 * @work: pointer to struct work_struct
32 *
33 * This event occurs when a work is queued immediately or once a
34 * delayed work is actually queued on a workqueue (ie: once the delay
35 * has been reached).
36 */
37TRACE_EVENT(workqueue_queue_work,
38
39 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
40 struct work_struct *work),
41
42 TP_ARGS(req_cpu, cwq, work),
43
44 TP_STRUCT__entry(
45 __field( void *, work )
46 __field( void *, function)
47 __field( void *, workqueue)
48 __field( unsigned int, req_cpu )
49 __field( unsigned int, cpu )
50 ),
51
52 TP_fast_assign(
53 __entry->work = work;
54 __entry->function = work->func;
55 __entry->workqueue = cwq->wq;
56 __entry->req_cpu = req_cpu;
57 __entry->cpu = cwq->gcwq->cpu;
58 ),
59
60 TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
61 __entry->work, __entry->function, __entry->workqueue,
62 __entry->req_cpu, __entry->cpu)
63);
64
65/**
66 * workqueue_activate_work - called when a work gets activated
67 * @work: pointer to struct work_struct
68 *
69 * This event occurs when a queued work is put on the active queue,
70 * which happens immediately after queueing unless @max_active limit
71 * is reached.
72 */
73DEFINE_EVENT(workqueue_work, workqueue_activate_work,
74
75 TP_PROTO(struct work_struct *work),
76
77 TP_ARGS(work)
78);
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 */
86TRACE_EVENT(workqueue_execute_start,
87
88 TP_PROTO(struct work_struct *work),
89
90 TP_ARGS(work),
91
92 TP_STRUCT__entry(
93 __field( void *, work )
94 __field( void *, function)
95 ),
96
97 TP_fast_assign(
98 __entry->work = work;
99 __entry->function = work->func;
100 ),
101
102 TP_printk("work struct %p: function %pf", __entry->work, __entry->function)
103);
104
105/**
106 * workqueue_execute_end - called immediately before the workqueue callback
107 * @work: pointer to struct work_struct
108 *
109 * Allows to track workqueue execution.
110 */
111DEFINE_EVENT(workqueue_work, workqueue_execute_end,
112
113 TP_PROTO(struct work_struct *work),
114
115 TP_ARGS(work)
116);
117
118#endif /* _TRACE_WORKQUEUE_H */
119
120/* This part must be outside protection */
121#include <trace/define_trace.h>
1/* SPDX-License-Identifier: GPL-2.0 */
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM workqueue
4
5#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_WORKQUEUE_H
7
8#include <linux/tracepoint.h>
9#include <linux/workqueue.h>
10
11struct pool_workqueue;
12
13/**
14 * workqueue_queue_work - called when a work gets queued
15 * @req_cpu: the requested cpu
16 * @pwq: pointer to struct pool_workqueue
17 * @work: pointer to struct work_struct
18 *
19 * This event occurs when a work is queued immediately or once a
20 * delayed work is actually queued on a workqueue (ie: once the delay
21 * has been reached).
22 */
23TRACE_EVENT(workqueue_queue_work,
24
25 TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
26 struct work_struct *work),
27
28 TP_ARGS(req_cpu, pwq, work),
29
30 TP_STRUCT__entry(
31 __field( void *, work )
32 __field( void *, function)
33 __string( workqueue, pwq->wq->name)
34 __field( int, req_cpu )
35 __field( int, cpu )
36 ),
37
38 TP_fast_assign(
39 __entry->work = work;
40 __entry->function = work->func;
41 __assign_str(workqueue);
42 __entry->req_cpu = req_cpu;
43 __entry->cpu = pwq->pool->cpu;
44 ),
45
46 TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%d cpu=%d",
47 __entry->work, __entry->function, __get_str(workqueue),
48 __entry->req_cpu, __entry->cpu)
49);
50
51/**
52 * workqueue_activate_work - called when a work gets activated
53 * @work: pointer to struct work_struct
54 *
55 * This event occurs when a queued work is put on the active queue,
56 * which happens immediately after queueing unless @max_active limit
57 * is reached.
58 */
59TRACE_EVENT(workqueue_activate_work,
60
61 TP_PROTO(struct work_struct *work),
62
63 TP_ARGS(work),
64
65 TP_STRUCT__entry(
66 __field( void *, work )
67 __field( void *, function)
68 ),
69
70 TP_fast_assign(
71 __entry->work = work;
72 __entry->function = work->func;
73 ),
74
75 TP_printk("work struct %p function=%ps ", __entry->work, __entry->function)
76);
77
78/**
79 * workqueue_execute_start - called immediately before the workqueue callback
80 * @work: pointer to struct work_struct
81 *
82 * Allows to track workqueue execution.
83 */
84TRACE_EVENT(workqueue_execute_start,
85
86 TP_PROTO(struct work_struct *work),
87
88 TP_ARGS(work),
89
90 TP_STRUCT__entry(
91 __field( void *, work )
92 __field( void *, function)
93 ),
94
95 TP_fast_assign(
96 __entry->work = work;
97 __entry->function = work->func;
98 ),
99
100 TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
101);
102
103/**
104 * workqueue_execute_end - called immediately after the workqueue callback
105 * @work: pointer to struct work_struct
106 * @function: pointer to worker function
107 *
108 * Allows to track workqueue execution.
109 */
110TRACE_EVENT(workqueue_execute_end,
111
112 TP_PROTO(struct work_struct *work, work_func_t function),
113
114 TP_ARGS(work, function),
115
116 TP_STRUCT__entry(
117 __field( void *, work )
118 __field( void *, function)
119 ),
120
121 TP_fast_assign(
122 __entry->work = work;
123 __entry->function = function;
124 ),
125
126 TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
127);
128
129#endif /* _TRACE_WORKQUEUE_H */
130
131/* This part must be outside protection */
132#include <trace/define_trace.h>