forked from kdavyd/dtrace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresilver_v4.d
executable file
·74 lines (66 loc) · 2.1 KB
/
resilver_v4.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
#!/usr/sbin/dtrace -s
#pragma D option quiet
/* Description: This script will show progress of any active resilvers
* happening on the system. It has been tested and sanity-checked on mirror
* and raidz1 vdevs, but since we are tracing deep within zio, should hold
* true for all other types. Note: It displays I/O in terms of read operations
* on the drives that we're resilvering *from*, in order to reflect read
* inflation for raidzN vdevs, where in order to reconstruct a block we have
* to read from all other devices in the same vdev.
*/
/* Author: [email protected] */
/* Copyright 2012-2015, Nexenta Systems, Inc. All rights reserved. */
/* Version: 0.2b-NS4 */
dtrace:::BEGIN
{
printf("Tracing with 10 second interval...\n");
printf("If there is no resilver happening, only timestamps will appear. \n");
}
zio_read:entry
/args[7] == 4/
/*
Priority 4 reads indicate ZIO_PRIORITY_RESILVER/SCRUB
This might change in the future, but for now it
looks like a safe way to detect only resilver IO.
*/
{
@ops = count();
@bs = quantize(args[4]);
@tp = sum(args[4]);
}
dsl_scan_scrub_cb:entry
/ args[0]->dp_scan->scn_phys.scn_func == 2 /
/* Scan function 2 is POOL_SCAN_RESILVER.
The only reason we're tracing here is
to determine throttling factor.
*/
{
self->in_scrub_cb = 1;
}
dsl_scan_scrub_cb:return
/ self->in_scrub_cb /
{
self->in_scrub_cb = NULL;
}
fbt:genunix:delay:entry
/ self->in_scrub_cb /
/*
Argh. What is a tick - 1ms or 10ms?
Based on observation, appears to be 10ms.
*/
{
@delay_times = count();
@delay_ticks = sum(args[0]);
}
tick-10sec
{
normalize(@tp, 10*1024);
normalize(@bs, 10);
normalize(@ops, 10);
printf("\n%Y", walltimestamp);
printa("\n\nResilver IOPs: %@d ",@ops);
printa("\nResilver Blocksize: %@a",@bs);
printa("\nResilver Throughput: %@d KB/sec",@tp);
printa("\nThrottled %@d times by %@d ticks in last interval", @delay_times, @delay_ticks);
trunc(@ops); trunc(@bs); trunc(@tp); trunc(@delay_times); trunc(@delay_ticks);
}