One more good one.  The printf action in DTrace supports variable length format 
items.  You know, the ones where an integer variable defines the length of the 
field at run time.  Example:

BEGIN
{
   x = 10;
   printf ("%*d", x, 123);
}

This prints the integer 123 in a field width of 10.  Since "x" can vary in 
value, how does this work in an environment where the trace record has to be 
fixed.  This works because DTrace doesn't record the result of the printf in a 
trace record: it records the arguments in the printf action (a string and two 
integers), which are all fixed length.  These trace records are later picked up 
by the dtrace command that is running safely in userland, where the printf is 
expanded/decoded and the results displayed.

Chip

You might ask how that works in a environment where the 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:dtrace-discuss-
> [EMAIL PROTECTED] On Behalf Of ??
> Sent: Wednesday, June 04, 2008 7:31 AM
> To: dtrace-discuss@opensolaris.org
> Subject: [dtrace-discuss] can i use if/else/for/while in dtrace script?
> 
> i am a newbie to solaris...
> 
> can i use if/else/for/while in dtrace script?
> 
> i see these are key words in dtrace, but when using it dtrace show
> syntax error...
> 
> i find through the doc and many examples , can't find same right
> syntax...
> 
> dtrace support this or not ?
> 
> thanks....
> 
> 
> --
> This message posted from opensolaris.org
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to