-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathscrub_v4.d
More file actions
72 lines (64 loc) · 1.9 KB
/
scrub_v4.d
File metadata and controls
72 lines (64 loc) · 1.9 KB
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
#!/usr/sbin/dtrace -s
#pragma D option quiet
/* Description: This script will show progress of any active scrubs
* 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. It is functionally equivalent to resilver.d, just
* traces scrub.
*/
/* Author: Kirill.Davydychev@Nexenta.com */
/* Copyright 2013-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 scrub happening, only timestamps will appear. \n");
}
zio_read:entry
/args[7] == 4/
/*
Priority 4 reads indicate ZIO_PRIORITY_SCRUB/RESILVER
This might change in the future, but for now it
looks like a safe way to detect only scrub IO.
*/
{
@ops = count();
@bs = quantize(args[4]);
@tp = sum(args[4]);
}
dsl_scan_scrub_cb:entry
/ args[0]->dp_scan->scn_phys.scn_func == 1 /
/* Scan function 1 is POOL_SCAN_SCRUB.
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\nScrub IOPs: %@d ",@ops);
printa("\nScrub Blocksize: %@a",@bs);
printa("\nScrub 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);
}