xref: /freebsd/sys/contrib/openzfs/include/os/linux/zfs/sys/trace_txg.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_txg
31 
32 #if !defined(_TRACE_TXG_H) || defined(TRACE_HEADER_MULTI_READ)
33 #define	_TRACE_TXG_H
34 
35 #include <linux/tracepoint.h>
36 #include <sys/types.h>
37 
38 /*
39  * Generic support for two argument tracepoints of the form:
40  *
41  * DTRACE_PROBE2(...,
42  *     dsl_pool_t *, ...,
43  *     uint64_t, ...);
44  */
45 /* BEGIN CSTYLED */
46 DECLARE_EVENT_CLASS(zfs_txg_class,
47 	TP_PROTO(dsl_pool_t *dp, uint64_t txg),
48 	TP_ARGS(dp, txg),
49 	TP_STRUCT__entry(
50 	    __field(uint64_t, txg)
51 	),
52 	TP_fast_assign(
53 	    __entry->txg = txg;
54 	),
55 	TP_printk("txg %llu", __entry->txg)
56 );
57 /* END CSTYLED */
58 
59 #define	DEFINE_TXG_EVENT(name) \
60 DEFINE_EVENT(zfs_txg_class, name, \
61     TP_PROTO(dsl_pool_t *dp, uint64_t txg), \
62     TP_ARGS(dp, txg))
63 DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done);
64 DEFINE_TXG_EVENT(zfs_txg__quiescing);
65 DEFINE_TXG_EVENT(zfs_txg__opened);
66 DEFINE_TXG_EVENT(zfs_txg__syncing);
67 DEFINE_TXG_EVENT(zfs_txg__synced);
68 DEFINE_TXG_EVENT(zfs_txg__quiesced);
69 
70 #endif /* _TRACE_TXG_H */
71 
72 #undef TRACE_INCLUDE_PATH
73 #undef TRACE_INCLUDE_FILE
74 #define	TRACE_INCLUDE_PATH sys
75 #define	TRACE_INCLUDE_FILE trace_txg
76 #include <trace/define_trace.h>
77 
78 #else
79 
80 DEFINE_DTRACE_PROBE2(dsl_pool_sync__done);
81 DEFINE_DTRACE_PROBE2(txg__quiescing);
82 DEFINE_DTRACE_PROBE2(txg__opened);
83 DEFINE_DTRACE_PROBE2(txg__syncing);
84 DEFINE_DTRACE_PROBE2(txg__synced);
85 DEFINE_DTRACE_PROBE2(txg__quiesced);
86 
87 #endif /* HAVE_DECLARE_EVENT_CLASS */
88 #endif /* _KERNEL */
89