xref: /illumos-gate/usr/src/test/zfs-tests/tests/perf/scripts/zil.d (revision 22028508fd28d36ff74dc02c5774a8ba1f0db045)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2016, 2018 by Delphix. All rights reserved.
14  */
15 
16 /*
17  * This measures metrics that relate to the performance of the ZIL.
18  *
19  * The "zil_commit" and "zil_commit_writer" fuctions are instrumented.
20  * For each function, the number of times each function is called is
21  * tracked, as well as the average latency for function, and a histogram
22  * of the latencies for each function.
23  */
24 
25 #pragma D option aggsortkey
26 #pragma D option quiet
27 
28 BEGIN
29 {
30 	@c["zil_commit"] = count();
31 	@a["zil_commit"] = avg(0);
32 	@h["zil_commit"] = quantize(0);
33 
34 	@c["zil_commit_writer"] = count();
35 	@a["zil_commit_writer"] = avg(0);
36 	@h["zil_commit_writer"] = quantize(0);
37 
38 	clear(@c);
39 	clear(@a);
40 	clear(@h);
41 }
42 
43 fbt:zfs:zil_commit:entry
44 / args[0]->zl_spa->spa_name == $$1 /
45 {
46 	self->zc_elapsed = timestamp;
47 }
48 
49 fbt:zfs:zil_commit:return
50 / self->zc_elapsed /
51 {
52 	@c[probefunc] = count();
53 	@a[probefunc] = avg(timestamp - self->zc_elapsed);
54 	@h[probefunc] = quantize(timestamp - self->zc_elapsed);
55 	self->zc_elapsed = 0;
56 }
57 
58 fbt:zfs:zil_commit_writer:entry
59 / self->zc_elapsed && args[0]->zl_spa->spa_name == $$1 /
60 {
61 	self->zcw_elapsed = timestamp;
62 }
63 
64 fbt:zfs:zil_commit_writer:return
65 / self->zcw_elapsed /
66 {
67 	@c[probefunc] = count();
68 	@a[probefunc] = avg(timestamp - self->zcw_elapsed);
69 	@h[probefunc] = quantize(timestamp - self->zcw_elapsed);
70 	self->zcw_elapsed = 0;
71 }
72 
73 tick-$2s
74 {
75 	printf("%u\n", `time);
76 	printa("counts_%-21s %@u\n", @c);
77 	printa("avgs_%-21s %@u\n", @a);
78 	printa("histograms_%-21s %@u\n", @h);
79 
80 	clear(@c);
81 	clear(@a);
82 	clear(@h);
83 }
84 
85 ERROR
86 {
87 	trace(arg1);
88 	trace(arg2);
89 	trace(arg3);
90 	trace(arg4);
91 	trace(arg5);
92 }
93