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