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_multilist
30eda14cbcSMatt Macy 
31eda14cbcSMatt Macy #if !defined(_TRACE_MULTILIST_H) || defined(TRACE_HEADER_MULTI_READ)
32eda14cbcSMatt Macy #define	_TRACE_MULTILIST_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  *     multilist_t *, ...,
42eda14cbcSMatt Macy  *     unsigned int, ...,
43eda14cbcSMatt Macy  *     void *, ...);
44eda14cbcSMatt Macy  */
45eda14cbcSMatt Macy /* BEGIN CSTYLED */
46eda14cbcSMatt Macy DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class,
47eda14cbcSMatt Macy 	TP_PROTO(multilist_t *ml, unsigned sublist_idx, void *obj),
48eda14cbcSMatt Macy 	TP_ARGS(ml, sublist_idx, obj),
49eda14cbcSMatt Macy 	TP_STRUCT__entry(
50eda14cbcSMatt Macy 	    __field(size_t,		ml_offset)
51eda14cbcSMatt Macy 	    __field(uint64_t,		ml_num_sublists)
52eda14cbcSMatt Macy 
53eda14cbcSMatt Macy 	    __field(unsigned int,	sublist_idx)
54eda14cbcSMatt Macy 	),
55eda14cbcSMatt Macy 	TP_fast_assign(
56eda14cbcSMatt Macy 	    __entry->ml_offset		= ml->ml_offset;
57eda14cbcSMatt Macy 	    __entry->ml_num_sublists	= ml->ml_num_sublists;
58eda14cbcSMatt Macy 
59eda14cbcSMatt Macy 	    __entry->sublist_idx	= sublist_idx;
60eda14cbcSMatt Macy 	),
61eda14cbcSMatt Macy 	TP_printk("ml { offset %ld numsublists %llu sublistidx %u } ",
62eda14cbcSMatt Macy 	    __entry->ml_offset, __entry->ml_num_sublists, __entry->sublist_idx)
63eda14cbcSMatt Macy );
64eda14cbcSMatt Macy /* END CSTYLED */
65eda14cbcSMatt Macy 
66eda14cbcSMatt Macy #define	DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \
67eda14cbcSMatt Macy DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \
68eda14cbcSMatt Macy     TP_PROTO(multilist_t *ml, unsigned int sublist_idx, void *obj), \
69eda14cbcSMatt Macy     TP_ARGS(ml, sublist_idx, obj))
70eda14cbcSMatt Macy DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__insert);
71eda14cbcSMatt Macy DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__remove);
72eda14cbcSMatt Macy 
73eda14cbcSMatt Macy #endif /* _TRACE_MULTILIST_H */
74eda14cbcSMatt Macy 
75eda14cbcSMatt Macy #undef TRACE_INCLUDE_PATH
76eda14cbcSMatt Macy #undef TRACE_INCLUDE_FILE
77eda14cbcSMatt Macy #define	TRACE_INCLUDE_PATH sys
78eda14cbcSMatt Macy #define	TRACE_INCLUDE_FILE trace_multilist
79eda14cbcSMatt Macy #include <trace/define_trace.h>
80eda14cbcSMatt Macy 
81eda14cbcSMatt Macy #else
82eda14cbcSMatt Macy 
83eda14cbcSMatt Macy DEFINE_DTRACE_PROBE3(multilist__insert);
84eda14cbcSMatt Macy DEFINE_DTRACE_PROBE3(multilist__remove);
85eda14cbcSMatt Macy 
86eda14cbcSMatt Macy #endif /* HAVE_DECLARE_EVENT_CLASS */
87eda14cbcSMatt Macy #endif /* _KERNEL */
88