FDD-book/examples/appendices/appendix-f-benchmarks/dtrace/dtrace_overhead.d

34 lines
723 B
D
Raw Normal View History

/*
* dtrace_overhead.d - a probe-only DTrace script used to measure
* the per-syscall overhead of attaching DTrace.
*
* The script fires on every syscall entry and return but does not
* print anything per probe. At exit it prints the total counts.
* Attach it while the workload programs run and compare their
* wall-clock times to the baseline.
*
* Usage (as root):
* dtrace -q -s dtrace_overhead.d
*
* Ctrl-C when the workload finishes.
*
* Companion to Appendix F of "FreeBSD Device Drivers: From First
* Steps to Kernel Mastery".
*/
syscall:::entry
{
@entries = count();
}
syscall:::return
{
@returns = count();
}
END
{
printa("entries=%@d\n", @entries);
printa("returns=%@d\n", @returns);
}