xref: /freebsd/sys/contrib/openzfs/include/os/linux/spl/sys/trace_taskq.h (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or https://opensource.org/licenses/CDDL-1.0.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 #if defined(_KERNEL)
24 #if defined(HAVE_DECLARE_EVENT_CLASS)
25 
26 #undef TRACE_SYSTEM
27 #define	TRACE_SYSTEM zfs
28 
29 #undef TRACE_SYSTEM_VAR
30 #define	TRACE_SYSTEM_VAR zfs_taskq
31 
32 #if !defined(_TRACE_TASKQ_H) || defined(TRACE_HEADER_MULTI_READ)
33 #define	_TRACE_TASKQ_H
34 
35 #include <linux/tracepoint.h>
36 #include <sys/types.h>
37 
38 /*
39  * Generic support for single argument tracepoints of the form:
40  *
41  * DTRACE_PROBE1(...,
42  *     taskq_ent_t *, ...);
43  */
44 DECLARE_EVENT_CLASS(zfs_taskq_ent_class,
45     TP_PROTO(taskq_ent_t *taskq_ent),
46     TP_ARGS(taskq_ent),
47     TP_STRUCT__entry(__field(taskq_ent_t *, taskq_ent)),
48     TP_fast_assign(
49 	__entry->taskq_ent = taskq_ent;
50 ),
51     TP_printk("taskq_ent %p", __entry->taskq_ent)
52 );
53 
54 #define	DEFINE_TASKQ_EVENT(name) \
55 DEFINE_EVENT(zfs_taskq_ent_class, name, \
56     TP_PROTO(taskq_ent_t *taskq_ent), \
57     TP_ARGS(taskq_ent))
58 DEFINE_TASKQ_EVENT(zfs_taskq_ent__birth);
59 DEFINE_TASKQ_EVENT(zfs_taskq_ent__start);
60 DEFINE_TASKQ_EVENT(zfs_taskq_ent__finish);
61 
62 #endif /* _TRACE_TASKQ_H */
63 
64 #undef TRACE_INCLUDE_PATH
65 #undef TRACE_INCLUDE_FILE
66 #define	TRACE_INCLUDE_PATH sys
67 #define	TRACE_INCLUDE_FILE trace_taskq
68 #include <trace/define_trace.h>
69 
70 #else
71 
72 /*
73  * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is
74  * needed for each DTRACE_PROBE.  These will be used to generate stub
75  * tracing functions and prototypes for those functions.  See
76  * include/os/linux/spl/sys/trace.h.
77  */
78 
79 DEFINE_DTRACE_PROBE1(taskq_ent__birth);
80 DEFINE_DTRACE_PROBE1(taskq_ent__start);
81 DEFINE_DTRACE_PROBE1(taskq_ent__finish);
82 
83 #endif /* HAVE_DECLARE_EVENT_CLASS */
84 #endif /* _KERNEL */
85