G'Day Chad,

On Tue, Apr 01, 2008 at 07:37:03AM -0400, Chad Mynhier wrote:
> 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 extra text also inflates the DTraceToolkit by a few megabytes; there
are also portability issues for systems that don't support printf(), or the
ability to print both capital and lower case letters at the same time.
A ported brendan() action could print all caps if need be, especially
useful for the thriving C-64 DTrace port.

> 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/

This is great work! :)

This webrev can seriously be used as a reference for understanding DTrace
action internals - including the test suite addition.

Brendan

-- 
Brendan
[CA, USA]
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to