-
Notifications
You must be signed in to change notification settings - Fork 2
/
dmu_write.d
executable file
·132 lines (109 loc) · 2.13 KB
/
dmu_write.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/sbin/dtrace -CqZs
/* Copyright ClusterHQ Inc. See LICENSE file for details. */
#pragma D option dynvarsize=80m
#pragma D option cleanrate=1000hz
#define WHERE (self->zpl_write ? "ZPL" : \
(self->ioc_recv ? "Receive" : \
(self->space_map ? "SpaceMap" : \
(self->history ? "History" : \
(self->spa ? "Spa" : "Other")))))
#define ACCOUNT(b) @counts[WHERE] = count() ; @bytes[WHERE] = sum(b)
#define IS_OTHER (!self->zpl_write && !self->ioc_recv && !self->space_map && !self->history && !self->spa)
/*
fbt::dmu_read:entry, fbt::dmu_read_uio:entry
{
@["read", func(caller)] = sum(arg3);
}
*/
/* ===== Caller detectors ===== */
fbt::zfs_freebsd_write:entry,
fbt::zfs_freebsd_putpages:entry
{
self->zpl_write = 1;
}
fbt::zfs_freebsd_write:return,
fbt::zfs_freebsd_putpages:return
{
self->zpl_write = 0;
}
fbt::zfs_ioc_recv:entry
{
self->ioc_recv = 1;
}
fbt::zfs_ioc_recv:return
{
self->ioc_recv = 0;
}
fbt::space_map_sync:entry
{
self->space_map = 1;
}
fbt::space_map_sync:return
{
self->space_map = 0;
}
fbt::spa_history_write:entry
{
self->history = 1;
}
fbt::spa_history_write:return
{
self->history = 0;
}
fbt::spa_sync_nvlist:entry,
fbt::bptree_add:entry,
fbt::bptree_iterate:entry,
fbt::bpobj_enqueue_subobj:entry
{
self->spa = 1;
}
fbt::spa_sync_nvlist:return,
fbt::bptree_add:return,
fbt::bptree_iterate:return,
fbt::bpobj_enqueue_subobj:return
{
self->spa = 0;
}
/* ===== Actual accounting ===== */
fbt::dmu_write:entry
{
ACCOUNT(arg3);
}
fbt::dmu_write_uio_dbuf:entry
{
ACCOUNT(arg2);
}
fbt::dmu_write_pages:entry
{
ACCOUNT(arg3);
}
fbt::dmu_assign_arcbuf:entry
{
ACCOUNT(args[2]->b_hdr->b_size);
}
fbt::dmu_write:entry,
fbt::dmu_write_uio_dbuf:entry,
fbt::dmu_write_pages:entry,
fbt::dmu_assign_arcbuf:entry
/IS_OTHER/
{
@others[stack()] = count();
}
/* Need to handle -1 size which means truncate to a given offset. */
/*
fbt::dmu_free_range:entry, fbt::dmu_free_long_range:entry
{
@["free", func(caller)] = sum(arg3);
}
*/
profile:::tick-$1s
{
printf("===\n");
printa("count_%s %@u\n", @counts);
clear(@counts);
printa("bytes_%s %@u\n", @bytes);
clear(@bytes);
printf("\n");
printa(@others);
trunc(@others);
}