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 http://www.opensolaris.org/os/licensing.
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 /* BEGIN CSTYLED */
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(
48 	    __field(taskq_ent_t *,	taskq_ent)
49 	),
50 	TP_fast_assign(
51 	    __entry->taskq_ent	= taskq_ent;
52 	),
53 	TP_printk("taskq_ent %p", __entry->taskq_ent)
54 );
55 /* END CSTYLED */
56 
57 /* BEGIN CSTYLED */
58 #define DEFINE_TASKQ_EVENT(name) \
59 DEFINE_EVENT(zfs_taskq_ent_class, name, \
60 	TP_PROTO(taskq_ent_t *taskq_ent), \
61 	TP_ARGS(taskq_ent))
62 /* END CSTYLED */
63 DEFINE_TASKQ_EVENT(zfs_taskq_ent__birth);
64 DEFINE_TASKQ_EVENT(zfs_taskq_ent__start);
65 DEFINE_TASKQ_EVENT(zfs_taskq_ent__finish);
66 
67 #endif /* _TRACE_TASKQ_H */
68 
69 #undef TRACE_INCLUDE_PATH
70 #undef TRACE_INCLUDE_FILE
71 #define	TRACE_INCLUDE_PATH sys
72 #define	TRACE_INCLUDE_FILE trace_taskq
73 #include <trace/define_trace.h>
74 
75 #else
76 
77 /*
78  * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is
79  * needed for each DTRACE_PROBE.  These will be used to generate stub
80  * tracing functions and prototypes for those functions.  See
81  * include/os/linux/spl/sys/trace.h.
82  */
83 
84 DEFINE_DTRACE_PROBE1(taskq_ent__birth);
85 DEFINE_DTRACE_PROBE1(taskq_ent__start);
86 DEFINE_DTRACE_PROBE1(taskq_ent__finish);
87 
88 #endif /* HAVE_DECLARE_EVENT_CLASS */
89 #endif /* _KERNEL */
90