-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathscrub.d
More file actions
70 lines (62 loc) · 1.78 KB
/
scrub.d
File metadata and controls
70 lines (62 loc) · 1.78 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
#!/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, Nexenta Systems, Inc. All rights reserved. */
/* Version: 0.1b */
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] == 20/
/*
Priority 20 reads indicate ZIO_PRIORITY_SCRUB
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
/*
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 = 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);
}