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 #include <sys/list.h>
23 
24 #if defined(_KERNEL)
25 #if defined(HAVE_DECLARE_EVENT_CLASS)
26 
27 #undef TRACE_SYSTEM
28 #define	TRACE_SYSTEM zfs
29 
30 #undef TRACE_SYSTEM_VAR
31 #define	TRACE_SYSTEM_VAR zfs_zio
32 
33 #if !defined(_TRACE_ZIO_H) || defined(TRACE_HEADER_MULTI_READ)
34 #define	_TRACE_ZIO_H
35 
36 #include <linux/tracepoint.h>
37 #include <sys/types.h>
38 #include <sys/trace_common.h> /* For ZIO macros */
39 
40 /* BEGIN CSTYLED */
41 TRACE_EVENT(zfs_zio__delay__miss,
42 	TP_PROTO(zio_t *zio, hrtime_t now),
43 	TP_ARGS(zio, now),
44 	TP_STRUCT__entry(
45 	    ZIO_TP_STRUCT_ENTRY
46 	    __field(hrtime_t, now)
47 	),
48 	TP_fast_assign(
49 	    ZIO_TP_FAST_ASSIGN
50 	    __entry->now = now;
51 	),
52 	TP_printk("now %llu " ZIO_TP_PRINTK_FMT, __entry->now,
53 	    ZIO_TP_PRINTK_ARGS)
54 );
55 
56 TRACE_EVENT(zfs_zio__delay__hit,
57 	TP_PROTO(zio_t *zio, hrtime_t now, hrtime_t diff),
58 	TP_ARGS(zio, now, diff),
59 	TP_STRUCT__entry(
60 	    ZIO_TP_STRUCT_ENTRY
61 	    __field(hrtime_t, now)
62 	    __field(hrtime_t, diff)
63 	),
64 	TP_fast_assign(
65 	    ZIO_TP_FAST_ASSIGN
66 	    __entry->now = now;
67 	    __entry->diff = diff;
68 	),
69 	TP_printk("now %llu diff %llu " ZIO_TP_PRINTK_FMT, __entry->now,
70 	    __entry->diff, ZIO_TP_PRINTK_ARGS)
71 );
72 
73 TRACE_EVENT(zfs_zio__delay__skip,
74 	TP_PROTO(zio_t *zio),
75 	TP_ARGS(zio),
76 	TP_STRUCT__entry(ZIO_TP_STRUCT_ENTRY),
77 	TP_fast_assign(ZIO_TP_FAST_ASSIGN),
78 	TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS)
79 );
80 /* END CSTYLED */
81 
82 #endif /* _TRACE_ZIO_H */
83 
84 #undef TRACE_INCLUDE_PATH
85 #undef TRACE_INCLUDE_FILE
86 #define	TRACE_INCLUDE_PATH sys
87 #define	TRACE_INCLUDE_FILE trace_zio
88 #include <trace/define_trace.h>
89 
90 #else
91 
92 DEFINE_DTRACE_PROBE2(zio__delay__miss);
93 DEFINE_DTRACE_PROBE3(zio__delay__hit);
94 DEFINE_DTRACE_PROBE1(zio__delay__skip);
95 
96 #endif /* HAVE_DECLARE_EVENT_CLASS */
97 #endif /* _KERNEL */
98