-
Notifications
You must be signed in to change notification settings - Fork 5
/
bigrwtime.d
53 lines (45 loc) · 1.23 KB
/
bigrwtime.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
#!/usr/sbin/dtrace -Cs
/*
* Look at I/Os and show their distributions.
* For devices taking more than 1ms, show them as slow devices
*/
#pragma D option quiet
dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}
io:::start
{
start_time[arg0] = timestamp;
}
io:::done
/(this->start = start_time[arg0]) && (timestamp - this->start) > 1000000000/
{
@devs["slow devs", args[1]->dev_pathname] = count();
}
io:::done
/(args[0]->b_flags & B_READ) && (this->start = start_time[arg0])/
{
this->delta = (timestamp - this->start) / 1000;
@plots["read I/O, us"] = quantize(this->delta);
@avgs["average read I/O, us"] = avg(this->delta);
start_time[arg0] = 0;
}
io:::done
/!(args[0]->b_flags & B_READ) && (this->start = start_time[arg0])/
{
this->delta = (timestamp - this->start) / 1000;
@plots["write I/O, us"] = quantize(this->delta);
@avgs["average write I/O, us"] = avg(this->delta);
start_time[arg0] = 0;
}
profile:::tick-10sec,
dtrace:::END
{
printf("%Y\n", walltimestamp);
printa(" %s\n%@d\n", @plots);
printa(@avgs);
printa(@devs);
trunc(@plots); trunc(@avgs); trunc(@devs)
}