]>
Commit | Line | Data |
---|---|---|
ea04106b AX |
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 | #include <sys/list.h> | |
23 | ||
24 | #if defined(_KERNEL) && defined(HAVE_DECLARE_EVENT_CLASS) | |
25 | ||
26 | #undef TRACE_SYSTEM | |
27 | #define TRACE_SYSTEM zfs | |
28 | ||
e10b0808 AX |
29 | #undef TRACE_SYSTEM_VAR |
30 | #define TRACE_SYSTEM_VAR zfs_arc | |
31 | ||
ea04106b AX |
32 | #if !defined(_TRACE_ARC_H) || defined(TRACE_HEADER_MULTI_READ) |
33 | #define _TRACE_ARC_H | |
34 | ||
35 | #include <linux/tracepoint.h> | |
36 | #include <sys/types.h> | |
cae5b340 | 37 | #include <sys/trace_common.h> /* For ZIO macros */ |
ea04106b AX |
38 | |
39 | /* | |
40 | * Generic support for one argument tracepoints of the form: | |
41 | * | |
42 | * DTRACE_PROBE1(..., | |
43 | * arc_buf_hdr_t *, ...); | |
44 | */ | |
cae5b340 | 45 | /* BEGIN CSTYLED */ |
ea04106b AX |
46 | DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class, |
47 | TP_PROTO(arc_buf_hdr_t *ab), | |
48 | TP_ARGS(ab), | |
49 | TP_STRUCT__entry( | |
50 | __array(uint64_t, hdr_dva_word, 2) | |
51 | __field(uint64_t, hdr_birth) | |
ea04106b | 52 | __field(uint32_t, hdr_flags) |
cae5b340 | 53 | __field(uint32_t, hdr_bufcnt) |
ea04106b | 54 | __field(arc_buf_contents_t, hdr_type) |
cae5b340 AX |
55 | __field(uint16_t, hdr_psize) |
56 | __field(uint16_t, hdr_lsize) | |
ea04106b AX |
57 | __field(uint64_t, hdr_spa) |
58 | __field(arc_state_type_t, hdr_state_type) | |
59 | __field(clock_t, hdr_access) | |
60 | __field(uint32_t, hdr_mru_hits) | |
61 | __field(uint32_t, hdr_mru_ghost_hits) | |
62 | __field(uint32_t, hdr_mfu_hits) | |
63 | __field(uint32_t, hdr_mfu_ghost_hits) | |
64 | __field(uint32_t, hdr_l2_hits) | |
65 | __field(int64_t, hdr_refcount) | |
66 | ), | |
67 | TP_fast_assign( | |
68 | __entry->hdr_dva_word[0] = ab->b_dva.dva_word[0]; | |
69 | __entry->hdr_dva_word[1] = ab->b_dva.dva_word[1]; | |
70 | __entry->hdr_birth = ab->b_birth; | |
ea04106b | 71 | __entry->hdr_flags = ab->b_flags; |
cae5b340 AX |
72 | __entry->hdr_bufcnt = ab->b_l1hdr.b_bufcnt; |
73 | __entry->hdr_psize = ab->b_psize; | |
74 | __entry->hdr_lsize = ab->b_lsize; | |
ea04106b | 75 | __entry->hdr_spa = ab->b_spa; |
e10b0808 AX |
76 | __entry->hdr_state_type = ab->b_l1hdr.b_state->arcs_state; |
77 | __entry->hdr_access = ab->b_l1hdr.b_arc_access; | |
78 | __entry->hdr_mru_hits = ab->b_l1hdr.b_mru_hits; | |
79 | __entry->hdr_mru_ghost_hits = ab->b_l1hdr.b_mru_ghost_hits; | |
80 | __entry->hdr_mfu_hits = ab->b_l1hdr.b_mfu_hits; | |
81 | __entry->hdr_mfu_ghost_hits = ab->b_l1hdr.b_mfu_ghost_hits; | |
82 | __entry->hdr_l2_hits = ab->b_l1hdr.b_l2_hits; | |
83 | __entry->hdr_refcount = ab->b_l1hdr.b_refcnt.rc_count; | |
ea04106b | 84 | ), |
e10b0808 | 85 | TP_printk("hdr { dva 0x%llx:0x%llx birth %llu " |
cae5b340 | 86 | "flags 0x%x bufcnt %u type %u psize %u lsize %u spa %llu " |
ea04106b AX |
87 | "state_type %u access %lu mru_hits %u mru_ghost_hits %u " |
88 | "mfu_hits %u mfu_ghost_hits %u l2_hits %u refcount %lli }", | |
89 | __entry->hdr_dva_word[0], __entry->hdr_dva_word[1], | |
e10b0808 | 90 | __entry->hdr_birth, __entry->hdr_flags, |
cae5b340 AX |
91 | __entry->hdr_bufcnt, __entry->hdr_type, __entry->hdr_psize, |
92 | __entry->hdr_lsize, __entry->hdr_spa, __entry->hdr_state_type, | |
ea04106b AX |
93 | __entry->hdr_access, __entry->hdr_mru_hits, |
94 | __entry->hdr_mru_ghost_hits, __entry->hdr_mfu_hits, | |
95 | __entry->hdr_mfu_ghost_hits, __entry->hdr_l2_hits, | |
96 | __entry->hdr_refcount) | |
97 | ); | |
cae5b340 | 98 | /* END CSTYLED */ |
ea04106b | 99 | |
cae5b340 | 100 | /* BEGIN CSTYLED */ |
ea04106b AX |
101 | #define DEFINE_ARC_BUF_HDR_EVENT(name) \ |
102 | DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \ | |
103 | TP_PROTO(arc_buf_hdr_t *ab), \ | |
104 | TP_ARGS(ab)) | |
cae5b340 | 105 | /* END CSTYLED */ |
ea04106b AX |
106 | DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit); |
107 | DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict); | |
108 | DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete); | |
109 | DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mru); | |
110 | DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mfu); | |
cae5b340 AX |
111 | DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__sync__wait__for__async); |
112 | DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__demand__hit__predictive__prefetch); | |
ea04106b AX |
113 | DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__hit); |
114 | DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__miss); | |
115 | ||
116 | /* | |
117 | * Generic support for two argument tracepoints of the form: | |
118 | * | |
119 | * DTRACE_PROBE2(..., | |
120 | * vdev_t *, ..., | |
121 | * zio_t *, ...); | |
122 | */ | |
cae5b340 | 123 | /* BEGIN CSTYLED */ |
ea04106b AX |
124 | DECLARE_EVENT_CLASS(zfs_l2arc_rw_class, |
125 | TP_PROTO(vdev_t *vd, zio_t *zio), | |
126 | TP_ARGS(vd, zio), | |
127 | TP_STRUCT__entry( | |
128 | __field(uint64_t, vdev_id) | |
129 | __field(uint64_t, vdev_guid) | |
130 | __field(uint64_t, vdev_state) | |
131 | ZIO_TP_STRUCT_ENTRY | |
132 | ), | |
133 | TP_fast_assign( | |
134 | __entry->vdev_id = vd->vdev_id; | |
135 | __entry->vdev_guid = vd->vdev_guid; | |
136 | __entry->vdev_state = vd->vdev_state; | |
137 | ZIO_TP_FAST_ASSIGN | |
138 | ), | |
139 | TP_printk("vdev { id %llu guid %llu state %llu } " | |
140 | ZIO_TP_PRINTK_FMT, __entry->vdev_id, __entry->vdev_guid, | |
141 | __entry->vdev_state, ZIO_TP_PRINTK_ARGS) | |
142 | ); | |
cae5b340 | 143 | /* END CSTYLED */ |
ea04106b | 144 | |
cae5b340 | 145 | /* BEGIN CSTYLED */ |
ea04106b AX |
146 | #define DEFINE_L2ARC_RW_EVENT(name) \ |
147 | DEFINE_EVENT(zfs_l2arc_rw_class, name, \ | |
148 | TP_PROTO(vdev_t *vd, zio_t *zio), \ | |
149 | TP_ARGS(vd, zio)) | |
cae5b340 | 150 | /* END CSTYLED */ |
ea04106b AX |
151 | DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read); |
152 | DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write); | |
153 | ||
154 | ||
155 | /* | |
156 | * Generic support for two argument tracepoints of the form: | |
157 | * | |
158 | * DTRACE_PROBE2(..., | |
159 | * zio_t *, ..., | |
160 | * l2arc_write_callback_t *, ...); | |
161 | */ | |
cae5b340 | 162 | /* BEGIN CSTYLED */ |
ea04106b AX |
163 | DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class, |
164 | TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), | |
165 | TP_ARGS(zio, cb), | |
166 | TP_STRUCT__entry(ZIO_TP_STRUCT_ENTRY), | |
167 | TP_fast_assign(ZIO_TP_FAST_ASSIGN), | |
168 | TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS) | |
169 | ); | |
cae5b340 | 170 | /* END CSTYLED */ |
ea04106b | 171 | |
cae5b340 | 172 | /* BEGIN CSTYLED */ |
ea04106b AX |
173 | #define DEFINE_L2ARC_IODONE_EVENT(name) \ |
174 | DEFINE_EVENT(zfs_l2arc_iodone_class, name, \ | |
175 | TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \ | |
176 | TP_ARGS(zio, cb)) | |
cae5b340 | 177 | /* END CSTYLED */ |
ea04106b AX |
178 | DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone); |
179 | ||
180 | ||
181 | /* | |
182 | * Generic support for four argument tracepoints of the form: | |
183 | * | |
184 | * DTRACE_PROBE4(..., | |
185 | * arc_buf_hdr_t *, ..., | |
186 | * const blkptr_t *, | |
187 | * uint64_t, | |
188 | * const zbookmark_phys_t *); | |
189 | */ | |
cae5b340 | 190 | /* BEGIN CSTYLED */ |
ea04106b AX |
191 | DECLARE_EVENT_CLASS(zfs_arc_miss_class, |
192 | TP_PROTO(arc_buf_hdr_t *hdr, | |
193 | const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), | |
194 | TP_ARGS(hdr, bp, size, zb), | |
195 | TP_STRUCT__entry( | |
196 | __array(uint64_t, hdr_dva_word, 2) | |
197 | __field(uint64_t, hdr_birth) | |
ea04106b | 198 | __field(uint32_t, hdr_flags) |
cae5b340 | 199 | __field(uint32_t, hdr_bufcnt) |
ea04106b | 200 | __field(arc_buf_contents_t, hdr_type) |
cae5b340 AX |
201 | __field(uint16_t, hdr_psize) |
202 | __field(uint16_t, hdr_lsize) | |
ea04106b AX |
203 | __field(uint64_t, hdr_spa) |
204 | __field(arc_state_type_t, hdr_state_type) | |
205 | __field(clock_t, hdr_access) | |
206 | __field(uint32_t, hdr_mru_hits) | |
207 | __field(uint32_t, hdr_mru_ghost_hits) | |
208 | __field(uint32_t, hdr_mfu_hits) | |
209 | __field(uint32_t, hdr_mfu_ghost_hits) | |
210 | __field(uint32_t, hdr_l2_hits) | |
211 | __field(int64_t, hdr_refcount) | |
212 | ||
213 | __array(uint64_t, bp_dva0, 2) | |
214 | __array(uint64_t, bp_dva1, 2) | |
215 | __array(uint64_t, bp_dva2, 2) | |
216 | __array(uint64_t, bp_cksum, 4) | |
217 | ||
218 | __field(uint64_t, bp_lsize) | |
219 | ||
220 | __field(uint64_t, zb_objset) | |
221 | __field(uint64_t, zb_object) | |
222 | __field(int64_t, zb_level) | |
223 | __field(uint64_t, zb_blkid) | |
224 | ), | |
225 | TP_fast_assign( | |
226 | __entry->hdr_dva_word[0] = hdr->b_dva.dva_word[0]; | |
227 | __entry->hdr_dva_word[1] = hdr->b_dva.dva_word[1]; | |
228 | __entry->hdr_birth = hdr->b_birth; | |
ea04106b | 229 | __entry->hdr_flags = hdr->b_flags; |
cae5b340 AX |
230 | __entry->hdr_bufcnt = hdr->b_l1hdr.b_bufcnt; |
231 | __entry->hdr_psize = hdr->b_psize; | |
232 | __entry->hdr_lsize = hdr->b_lsize; | |
ea04106b | 233 | __entry->hdr_spa = hdr->b_spa; |
e10b0808 AX |
234 | __entry->hdr_state_type = hdr->b_l1hdr.b_state->arcs_state; |
235 | __entry->hdr_access = hdr->b_l1hdr.b_arc_access; | |
236 | __entry->hdr_mru_hits = hdr->b_l1hdr.b_mru_hits; | |
237 | __entry->hdr_mru_ghost_hits = hdr->b_l1hdr.b_mru_ghost_hits; | |
238 | __entry->hdr_mfu_hits = hdr->b_l1hdr.b_mfu_hits; | |
239 | __entry->hdr_mfu_ghost_hits = hdr->b_l1hdr.b_mfu_ghost_hits; | |
240 | __entry->hdr_l2_hits = hdr->b_l1hdr.b_l2_hits; | |
241 | __entry->hdr_refcount = hdr->b_l1hdr.b_refcnt.rc_count; | |
ea04106b AX |
242 | |
243 | __entry->bp_dva0[0] = bp->blk_dva[0].dva_word[0]; | |
244 | __entry->bp_dva0[1] = bp->blk_dva[0].dva_word[1]; | |
245 | __entry->bp_dva1[0] = bp->blk_dva[1].dva_word[0]; | |
246 | __entry->bp_dva1[1] = bp->blk_dva[1].dva_word[1]; | |
247 | __entry->bp_dva2[0] = bp->blk_dva[2].dva_word[0]; | |
248 | __entry->bp_dva2[1] = bp->blk_dva[2].dva_word[1]; | |
249 | __entry->bp_cksum[0] = bp->blk_cksum.zc_word[0]; | |
250 | __entry->bp_cksum[1] = bp->blk_cksum.zc_word[1]; | |
251 | __entry->bp_cksum[2] = bp->blk_cksum.zc_word[2]; | |
252 | __entry->bp_cksum[3] = bp->blk_cksum.zc_word[3]; | |
253 | ||
254 | __entry->bp_lsize = size; | |
255 | ||
256 | __entry->zb_objset = zb->zb_objset; | |
257 | __entry->zb_object = zb->zb_object; | |
258 | __entry->zb_level = zb->zb_level; | |
259 | __entry->zb_blkid = zb->zb_blkid; | |
260 | ), | |
e10b0808 | 261 | TP_printk("hdr { dva 0x%llx:0x%llx birth %llu " |
cae5b340 | 262 | "flags 0x%x bufcnt %u psize %u lsize %u spa %llu state_type %u " |
ea04106b AX |
263 | "access %lu mru_hits %u mru_ghost_hits %u mfu_hits %u " |
264 | "mfu_ghost_hits %u l2_hits %u refcount %lli } " | |
265 | "bp { dva0 0x%llx:0x%llx dva1 0x%llx:0x%llx dva2 " | |
266 | "0x%llx:0x%llx cksum 0x%llx:0x%llx:0x%llx:0x%llx " | |
267 | "lsize %llu } zb { objset %llu object %llu level %lli " | |
268 | "blkid %llu }", | |
269 | __entry->hdr_dva_word[0], __entry->hdr_dva_word[1], | |
e10b0808 | 270 | __entry->hdr_birth, __entry->hdr_flags, |
cae5b340 | 271 | __entry->hdr_bufcnt, __entry->hdr_psize, __entry->hdr_lsize, |
ea04106b AX |
272 | __entry->hdr_spa, __entry->hdr_state_type, __entry->hdr_access, |
273 | __entry->hdr_mru_hits, __entry->hdr_mru_ghost_hits, | |
274 | __entry->hdr_mfu_hits, __entry->hdr_mfu_ghost_hits, | |
275 | __entry->hdr_l2_hits, __entry->hdr_refcount, | |
276 | __entry->bp_dva0[0], __entry->bp_dva0[1], | |
277 | __entry->bp_dva1[0], __entry->bp_dva1[1], | |
278 | __entry->bp_dva2[0], __entry->bp_dva2[1], | |
279 | __entry->bp_cksum[0], __entry->bp_cksum[1], | |
280 | __entry->bp_cksum[2], __entry->bp_cksum[3], | |
281 | __entry->bp_lsize, __entry->zb_objset, __entry->zb_object, | |
282 | __entry->zb_level, __entry->zb_blkid) | |
283 | ); | |
cae5b340 | 284 | /* END CSTYLED */ |
ea04106b | 285 | |
cae5b340 | 286 | /* BEGIN CSTYLED */ |
ea04106b AX |
287 | #define DEFINE_ARC_MISS_EVENT(name) \ |
288 | DEFINE_EVENT(zfs_arc_miss_class, name, \ | |
289 | TP_PROTO(arc_buf_hdr_t *hdr, \ | |
290 | const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \ | |
291 | TP_ARGS(hdr, bp, size, zb)) | |
cae5b340 | 292 | /* END CSTYLED */ |
ea04106b AX |
293 | DEFINE_ARC_MISS_EVENT(zfs_arc__miss); |
294 | ||
295 | /* | |
296 | * Generic support for four argument tracepoints of the form: | |
297 | * | |
298 | * DTRACE_PROBE4(..., | |
299 | * l2arc_dev_t *, ..., | |
300 | * list_t *, ..., | |
301 | * uint64_t, ..., | |
302 | * boolean_t, ...); | |
303 | */ | |
cae5b340 | 304 | /* BEGIN CSTYLED */ |
ea04106b AX |
305 | DECLARE_EVENT_CLASS(zfs_l2arc_evict_class, |
306 | TP_PROTO(l2arc_dev_t *dev, | |
307 | list_t *buflist, uint64_t taddr, boolean_t all), | |
308 | TP_ARGS(dev, buflist, taddr, all), | |
309 | TP_STRUCT__entry( | |
310 | __field(uint64_t, vdev_id) | |
311 | __field(uint64_t, vdev_guid) | |
312 | __field(uint64_t, vdev_state) | |
313 | ||
314 | __field(uint64_t, l2ad_hand) | |
315 | __field(uint64_t, l2ad_start) | |
316 | __field(uint64_t, l2ad_end) | |
ea04106b AX |
317 | __field(boolean_t, l2ad_first) |
318 | __field(boolean_t, l2ad_writing) | |
319 | ||
320 | __field(uint64_t, taddr) | |
321 | __field(boolean_t, all) | |
322 | ), | |
323 | TP_fast_assign( | |
324 | __entry->vdev_id = dev->l2ad_vdev->vdev_id; | |
325 | __entry->vdev_guid = dev->l2ad_vdev->vdev_guid; | |
326 | __entry->vdev_state = dev->l2ad_vdev->vdev_state; | |
327 | ||
328 | __entry->l2ad_hand = dev->l2ad_hand; | |
329 | __entry->l2ad_start = dev->l2ad_start; | |
330 | __entry->l2ad_end = dev->l2ad_end; | |
ea04106b AX |
331 | __entry->l2ad_first = dev->l2ad_first; |
332 | __entry->l2ad_writing = dev->l2ad_writing; | |
333 | ||
334 | __entry->taddr = taddr; | |
335 | __entry->all = all; | |
336 | ), | |
337 | TP_printk("l2ad { vdev { id %llu guid %llu state %llu } " | |
e10b0808 | 338 | "hand %llu start %llu end %llu " |
ea04106b AX |
339 | "first %d writing %d } taddr %llu all %d", |
340 | __entry->vdev_id, __entry->vdev_guid, __entry->vdev_state, | |
341 | __entry->l2ad_hand, __entry->l2ad_start, | |
e10b0808 | 342 | __entry->l2ad_end, __entry->l2ad_first, __entry->l2ad_writing, |
ea04106b AX |
343 | __entry->taddr, __entry->all) |
344 | ); | |
cae5b340 | 345 | /* END CSTYLED */ |
ea04106b | 346 | |
cae5b340 | 347 | /* BEGIN CSTYLED */ |
ea04106b AX |
348 | #define DEFINE_L2ARC_EVICT_EVENT(name) \ |
349 | DEFINE_EVENT(zfs_l2arc_evict_class, name, \ | |
350 | TP_PROTO(l2arc_dev_t *dev, \ | |
351 | list_t *buflist, uint64_t taddr, boolean_t all), \ | |
352 | TP_ARGS(dev, buflist, taddr, all)) | |
cae5b340 | 353 | /* END CSTYLED */ |
ea04106b AX |
354 | DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict); |
355 | ||
356 | #endif /* _TRACE_ARC_H */ | |
357 | ||
358 | #undef TRACE_INCLUDE_PATH | |
359 | #undef TRACE_INCLUDE_FILE | |
360 | #define TRACE_INCLUDE_PATH sys | |
361 | #define TRACE_INCLUDE_FILE trace_arc | |
362 | #include <trace/define_trace.h> | |
363 | ||
364 | #endif /* _KERNEL && HAVE_DECLARE_EVENT_CLASS */ |