forked from richardelling/dtrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrwtime-10sec.d
More file actions
executable file
·40 lines (34 loc) · 817 Bytes
/
rwtime-10sec.d
File metadata and controls
executable file
·40 lines (34 loc) · 817 Bytes
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
#!/usr/sbin/dtrace -s
#pragma D option quiet
dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}
io:::start
{
start_time[arg0] = timestamp;
}
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);
trunc(@plots); trunc(@avgs);
}