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