mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
31 lines
589 B
D
31 lines
589 B
D
|
|
#!/usr/sbin/dtrace -s
|
||
|
|
/*
|
||
|
|
* read-latency.d - histogram the latency of perfdemo_read in nanoseconds.
|
||
|
|
*
|
||
|
|
* Usage: sudo dtrace -s read-latency.d
|
||
|
|
*
|
||
|
|
* Run a workload against /dev/perfdemo in another terminal. Let this
|
||
|
|
* script run for 30 seconds, then Ctrl-C. The output is a quantize()
|
||
|
|
* histogram of latencies in ns, bucketed by power of two.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#pragma D option quiet
|
||
|
|
#pragma D option dynvarsize=16m
|
||
|
|
|
||
|
|
fbt:perfdemo:perfdemo_read:entry
|
||
|
|
{
|
||
|
|
self->ts = timestamp;
|
||
|
|
}
|
||
|
|
|
||
|
|
fbt:perfdemo:perfdemo_read:return
|
||
|
|
/self->ts/
|
||
|
|
{
|
||
|
|
@ = quantize(timestamp - self->ts);
|
||
|
|
self->ts = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
END
|
||
|
|
{
|
||
|
|
printa(@);
|
||
|
|
}
|