FDD-book/examples/part-07/ch33-performance/lab02-dtrace-scripts/read-latency.d

31 lines
589 B
D
Raw Permalink Normal View History

#!/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(@);
}