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