1eda14cbcSMatt Macy /*
2eda14cbcSMatt Macy  * CDDL HEADER START
3eda14cbcSMatt Macy  *
4eda14cbcSMatt Macy  * The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy  * Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy  * You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy  *
8eda14cbcSMatt Macy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*271171e0SMartin Matuska  * or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy  * See the License for the specific language governing permissions
11eda14cbcSMatt Macy  * and limitations under the License.
12eda14cbcSMatt Macy  *
13eda14cbcSMatt Macy  * When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy  * If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy  * fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy  * information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy  *
19eda14cbcSMatt Macy  * CDDL HEADER END
20eda14cbcSMatt Macy  */
21eda14cbcSMatt Macy 
22eda14cbcSMatt Macy #if defined(_KERNEL)
23eda14cbcSMatt Macy #if defined(HAVE_DECLARE_EVENT_CLASS)
24eda14cbcSMatt Macy 
25eda14cbcSMatt Macy #undef TRACE_SYSTEM
26eda14cbcSMatt Macy #define	TRACE_SYSTEM zfs
27eda14cbcSMatt Macy 
28eda14cbcSMatt Macy #undef TRACE_SYSTEM_VAR
29eda14cbcSMatt Macy #define	TRACE_SYSTEM_VAR zfs_txg
30eda14cbcSMatt Macy 
31eda14cbcSMatt Macy #if !defined(_TRACE_TXG_H) || defined(TRACE_HEADER_MULTI_READ)
32eda14cbcSMatt Macy #define	_TRACE_TXG_H
33eda14cbcSMatt Macy 
34eda14cbcSMatt Macy #include <linux/tracepoint.h>
35eda14cbcSMatt Macy #include <sys/types.h>
36eda14cbcSMatt Macy 
37eda14cbcSMatt Macy /*
38eda14cbcSMatt Macy  * Generic support for two argument tracepoints of the form:
39eda14cbcSMatt Macy  *
40eda14cbcSMatt Macy  * DTRACE_PROBE2(...,
41eda14cbcSMatt Macy  *     dsl_pool_t *, ...,
42eda14cbcSMatt Macy  *     uint64_t, ...);
43eda14cbcSMatt Macy  */
44eda14cbcSMatt Macy /* BEGIN CSTYLED */
45eda14cbcSMatt Macy DECLARE_EVENT_CLASS(zfs_txg_class,
46eda14cbcSMatt Macy 	TP_PROTO(dsl_pool_t *dp, uint64_t txg),
47eda14cbcSMatt Macy 	TP_ARGS(dp, txg),
48eda14cbcSMatt Macy 	TP_STRUCT__entry(
49eda14cbcSMatt Macy 	    __field(uint64_t, txg)
50eda14cbcSMatt Macy 	),
51eda14cbcSMatt Macy 	TP_fast_assign(
52eda14cbcSMatt Macy 	    __entry->txg = txg;
53eda14cbcSMatt Macy 	),
54eda14cbcSMatt Macy 	TP_printk("txg %llu", __entry->txg)
55eda14cbcSMatt Macy );
56eda14cbcSMatt Macy /* END CSTYLED */
57eda14cbcSMatt Macy 
58eda14cbcSMatt Macy #define	DEFINE_TXG_EVENT(name) \
59eda14cbcSMatt Macy DEFINE_EVENT(zfs_txg_class, name, \
60eda14cbcSMatt Macy     TP_PROTO(dsl_pool_t *dp, uint64_t txg), \
61eda14cbcSMatt Macy     TP_ARGS(dp, txg))
62eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done);
63eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_txg__quiescing);
64eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_txg__opened);
65eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_txg__syncing);
66eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_txg__synced);
67eda14cbcSMatt Macy DEFINE_TXG_EVENT(zfs_txg__quiesced);
68eda14cbcSMatt Macy 
69eda14cbcSMatt Macy #endif /* _TRACE_TXG_H */
70eda14cbcSMatt Macy 
71eda14cbcSMatt Macy #undef TRACE_INCLUDE_PATH
72eda14cbcSMatt Macy #undef TRACE_INCLUDE_FILE
73eda14cbcSMatt Macy #define	TRACE_INCLUDE_PATH sys
74eda14cbcSMatt Macy #define	TRACE_INCLUDE_FILE trace_txg
75eda14cbcSMatt Macy #include <trace/define_trace.h>
76eda14cbcSMatt Macy 
77eda14cbcSMatt Macy #else
78eda14cbcSMatt Macy 
79eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(dsl_pool_sync__done);
80eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(txg__quiescing);
81eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(txg__opened);
82eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(txg__syncing);
83eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(txg__synced);
84eda14cbcSMatt Macy DEFINE_DTRACE_PROBE2(txg__quiesced);
85eda14cbcSMatt Macy 
86eda14cbcSMatt Macy #endif /* HAVE_DECLARE_EVENT_CLASS */
87eda14cbcSMatt Macy #endif /* _KERNEL */
88