This came up as an RFE during the conference (I believe it's been logged
as "4012008: brendan() action needed for DTrace Toolkit".)
As everyone here is aware, DTrace is not quite as user friendly as it
could be. For the uninitiated, it can be confusing to run a DTrace
script and not see the expected output. Brendan Gregg has addressed
this in the DTrace Toolkit[1] by including a BEGIN probe in each script
to alert the uninitiated, i.e.:
dtrace:::BEGIN
{
printf("Tracing... Hit Ctrl-C to end.\n");
}
Unfortunately, this can lead to much unnecessary typing, and it leaves
open the possibility of human error (e.g., "Tracing... Hit Ctrl-D to
end.\n") To address these problems, I've implemented the brendan()
action. The brendan() action addresses both problems in that it is
shorter to type and that it removes the possibility of errors. (A typo
in the name of the brendan() action, e.g., brandon(), would be caught as
an error by the D compiler.)
The DTrace test suite script for this, misc/tst.brendan.d, demonstrates
the usage:
------------------------------------------------------------------------
#pragma D option quiet
BEGIN
{
brendan();
exit(0);
}
------------------------------------------------------------------------
with the resulting output:
------------------------------------------------------------------------
Tracing... Hit Ctrl-C to end.
------------------------------------------------------------------------
I've put up a webrev for this at the following URL:
http://cr.opensolaris.org/~cmynhier/brendan/
[1] http://www.brendangregg.com/dtrace.html
_______________________________________________
dtrace-discuss mailing list
[email protected]