-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrw.d
executable file
·65 lines (54 loc) · 1.73 KB
/
rw.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
#!/usr/sbin/dtrace -s
/*
* Borrowed from the very useful blog post here:
*
* http://dtrace.org/blogs/ahl/2014/08/31/openzfs-tuning/
*
* Updated to work on FreeBSD 10.1
*
* Including improvements from baitisj to make it
* more concise and clear under FreeBSD
*
*/
#pragma D option quiet
#pragma D option dynvarsize=64m
#pragma D option bufsize=16m
#pragma D option switchrate=10hz
BEGIN
{
bio_cmd[1] = "Read";
bio_cmd[2] = "Write";
bio_cmd[4] = "Delete";
bio_cmd[8] = "Getattr";
bio_cmd[16] = "Flush";
start = timestamp;
}
io:::start
/args[0] != NULL && args[1] != NULL/
{
/* Rather than relying on args[0]->bio_disk->d_geom->name, */
/* FreeBSD assigns a unique device_number per device.*/
/* See man devstat for more information */
ts[args[1]->device_number, args[0]->bio_pblkno] = timestamp;
}
io:::done
/args[0] != NULL && args[1] != NULL && ts[args[1]->device_number, args[0]->bio_pblkno]/
{
this->delta = (timestamp - ts[args[1]->device_number, args[0]->bio_pblkno]) / 1000;
this->name = bio_cmd[args[0]->bio_cmd];
@q[this->name] = quantize(this->delta);
@a[this->name] = avg(this->delta);
@v[this->name] = stddev(this->delta);
@i[this->name] = count();
@b[this->name] = sum(args[0]->bio_bcount);
ts[args[1]->device_number, args[0]->bio_pblkno] = 0;
}
END
{
printa(@q);
normalize(@i, (timestamp - start) / 1000000000);
normalize(@b, (timestamp - start) / 1000000000 * 1024);
printf("%-30s %11s %11s %11s %11s\n", "", "avg latency", "stddev",
"iops", "throughput");
printa("%-30s %@9uus %@9uus %@9u/s %@8uk/s\n", @a, @v, @i, @b);
}