]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/os/linux/zfs/sys/trace_dmu.h
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / include / os / linux / zfs / sys / trace_dmu.h
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_dmu
30
31 #if !defined(_TRACE_DMU_H) || defined(TRACE_HEADER_MULTI_READ)
32 #define _TRACE_DMU_H
33
34 #include <linux/tracepoint.h>
35 #include <sys/types.h>
36
37 /*
38  * Generic support for three argument tracepoints of the form:
39  *
40  * DTRACE_PROBE3(...,
41  *     dmu_tx_t *, ...,
42  *     uint64_t, ...,
43  *     uint64_t, ...);
44  */
45 /* BEGIN CSTYLED */
46 DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
47         TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time),
48         TP_ARGS(tx, dirty, min_tx_time),
49         TP_STRUCT__entry(
50             __field(uint64_t,                   tx_txg)
51             __field(uint64_t,                   tx_lastsnap_txg)
52             __field(uint64_t,                   tx_lasttried_txg)
53             __field(boolean_t,                  tx_anyobj)
54             __field(boolean_t,                  tx_dirty_delayed)
55             __field(hrtime_t,                   tx_start)
56             __field(boolean_t,                  tx_wait_dirty)
57             __field(int,                        tx_err)
58             __field(uint64_t,                   min_tx_time)
59             __field(uint64_t,                   dirty)
60         ),
61         TP_fast_assign(
62             __entry->tx_txg                     = tx->tx_txg;
63             __entry->tx_lastsnap_txg            = tx->tx_lastsnap_txg;
64             __entry->tx_lasttried_txg           = tx->tx_lasttried_txg;
65             __entry->tx_anyobj                  = tx->tx_anyobj;
66             __entry->tx_dirty_delayed           = tx->tx_dirty_delayed;
67             __entry->tx_start                   = tx->tx_start;
68             __entry->tx_wait_dirty              = tx->tx_wait_dirty;
69             __entry->tx_err                     = tx->tx_err;
70             __entry->dirty                      = dirty;
71             __entry->min_tx_time                = min_tx_time;
72         ),
73         TP_printk("tx { txg %llu lastsnap_txg %llu tx_lasttried_txg %llu "
74             "anyobj %d dirty_delayed %d start %llu wait_dirty %d err %i "
75             "} dirty %llu min_tx_time %llu",
76             __entry->tx_txg, __entry->tx_lastsnap_txg,
77             __entry->tx_lasttried_txg, __entry->tx_anyobj,
78             __entry->tx_dirty_delayed, __entry->tx_start,
79             __entry->tx_wait_dirty, __entry->tx_err,
80             __entry->dirty, __entry->min_tx_time)
81 );
82 /* END CSTYLED */
83
84 /* BEGIN CSTYLED */
85 #define DEFINE_DELAY_MINTIME_EVENT(name) \
86 DEFINE_EVENT(zfs_delay_mintime_class, name, \
87         TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \
88         TP_ARGS(tx, dirty, min_tx_time))
89 /* END CSTYLED */
90 DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime);
91
92 /* BEGIN CSTYLED */
93 DECLARE_EVENT_CLASS(zfs_free_long_range_class,
94         TP_PROTO(uint64_t long_free_dirty_all_txgs, uint64_t chunk_len, \
95             uint64_t txg),
96         TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg),
97         TP_STRUCT__entry(
98             __field(uint64_t,                   long_free_dirty_all_txgs)
99             __field(uint64_t,                   chunk_len)
100             __field(uint64_t,                   txg)
101         ),
102         TP_fast_assign(
103             __entry->long_free_dirty_all_txgs   = long_free_dirty_all_txgs;
104             __entry->chunk_len                                  = chunk_len;
105             __entry->txg                                                = txg;
106         ),
107         TP_printk("long_free_dirty_all_txgs %llu chunk_len %llu txg %llu",
108            __entry->long_free_dirty_all_txgs,
109            __entry->chunk_len, __entry->txg)
110 );
111 /* END CSTYLED */
112
113 /* BEGIN CSTYLED */
114 #define DEFINE_FREE_LONG_RANGE_EVENT(name) \
115 DEFINE_EVENT(zfs_free_long_range_class, name, \
116         TP_PROTO(uint64_t long_free_dirty_all_txgs, \
117             uint64_t chunk_len, uint64_t txg), \
118         TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg))
119 /* END CSTYLED */
120 DEFINE_FREE_LONG_RANGE_EVENT(zfs_free__long__range);
121
122 #endif /* _TRACE_DMU_H */
123
124 #undef TRACE_INCLUDE_PATH
125 #undef TRACE_INCLUDE_FILE
126 #define TRACE_INCLUDE_PATH sys
127 #define TRACE_INCLUDE_FILE trace_dmu
128 #include <trace/define_trace.h>
129
130 #else
131
132 DEFINE_DTRACE_PROBE3(delay__mintime);
133 DEFINE_DTRACE_PROBE3(free__long__range);
134
135 #endif /* HAVE_DECLARE_EVENT_CLASS */
136 #endif /* _KERNEL */