Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM workqueue
0004 
0005 #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_WORKQUEUE_H
0007 
0008 #include <linux/tracepoint.h>
0009 #include <linux/workqueue.h>
0010 
0011 struct pool_workqueue;
0012 
0013 /**
0014  * workqueue_queue_work - called when a work gets queued
0015  * @req_cpu:    the requested cpu
0016  * @pwq:    pointer to struct pool_workqueue
0017  * @work:   pointer to struct work_struct
0018  *
0019  * This event occurs when a work is queued immediately or once a
0020  * delayed work is actually queued on a workqueue (ie: once the delay
0021  * has been reached).
0022  */
0023 TRACE_EVENT(workqueue_queue_work,
0024 
0025     TP_PROTO(int req_cpu, struct pool_workqueue *pwq,
0026          struct work_struct *work),
0027 
0028     TP_ARGS(req_cpu, pwq, work),
0029 
0030     TP_STRUCT__entry(
0031         __field( void *,    work    )
0032         __field( void *,    function)
0033         __string( workqueue,    pwq->wq->name)
0034         __field( int,   req_cpu )
0035         __field( int,   cpu )
0036     ),
0037 
0038     TP_fast_assign(
0039         __entry->work       = work;
0040         __entry->function   = work->func;
0041         __assign_str(workqueue, pwq->wq->name);
0042         __entry->req_cpu    = req_cpu;
0043         __entry->cpu        = pwq->pool->cpu;
0044     ),
0045 
0046     TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%d cpu=%d",
0047           __entry->work, __entry->function, __get_str(workqueue),
0048           __entry->req_cpu, __entry->cpu)
0049 );
0050 
0051 /**
0052  * workqueue_activate_work - called when a work gets activated
0053  * @work:   pointer to struct work_struct
0054  *
0055  * This event occurs when a queued work is put on the active queue,
0056  * which happens immediately after queueing unless @max_active limit
0057  * is reached.
0058  */
0059 TRACE_EVENT(workqueue_activate_work,
0060 
0061     TP_PROTO(struct work_struct *work),
0062 
0063     TP_ARGS(work),
0064 
0065     TP_STRUCT__entry(
0066         __field( void *,    work    )
0067     ),
0068 
0069     TP_fast_assign(
0070         __entry->work       = work;
0071     ),
0072 
0073     TP_printk("work struct %p", __entry->work)
0074 );
0075 
0076 /**
0077  * workqueue_execute_start - called immediately before the workqueue callback
0078  * @work:   pointer to struct work_struct
0079  *
0080  * Allows to track workqueue execution.
0081  */
0082 TRACE_EVENT(workqueue_execute_start,
0083 
0084     TP_PROTO(struct work_struct *work),
0085 
0086     TP_ARGS(work),
0087 
0088     TP_STRUCT__entry(
0089         __field( void *,    work    )
0090         __field( void *,    function)
0091     ),
0092 
0093     TP_fast_assign(
0094         __entry->work       = work;
0095         __entry->function   = work->func;
0096     ),
0097 
0098     TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
0099 );
0100 
0101 /**
0102  * workqueue_execute_end - called immediately after the workqueue callback
0103  * @work:   pointer to struct work_struct
0104  * @function:   pointer to worker function
0105  *
0106  * Allows to track workqueue execution.
0107  */
0108 TRACE_EVENT(workqueue_execute_end,
0109 
0110     TP_PROTO(struct work_struct *work, work_func_t function),
0111 
0112     TP_ARGS(work, function),
0113 
0114     TP_STRUCT__entry(
0115         __field( void *,    work    )
0116         __field( void *,    function)
0117     ),
0118 
0119     TP_fast_assign(
0120         __entry->work       = work;
0121         __entry->function   = function;
0122     ),
0123 
0124     TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
0125 );
0126 
0127 #endif /*  _TRACE_WORKQUEUE_H */
0128 
0129 /* This part must be outside protection */
0130 #include <trace/define_trace.h>