If you're a little more concerned with getting it close to 10 seconds,
you can use something like this:

tick-1s
/ i++ >= 10 /
{
    exit(0);
}

The reason the tick-10s probe might fire sooner than 10 seconds is
that DTrace will use an existing probe if there is one.  If script A
is the first to create a tick-10s probe, it will fire after 10
seconds.  If script B enables a tick-10s, it will fall into lockstep
with script A.  If script B is started 9 seconds after script A, the
first time it will fire is after 1 second.

The above trick really only gets you better resolution.  Instead of
your D script exiting sometime between 0 and 10 seconds, it would exit
sometime between 9 and 10 seconds.

Chad

On Mon, Oct 19, 2009 at 12:45 PM, Angelo Rajadurai
<angelo.rajadu...@sun.com> wrote:
> Add a tick-10s probe to the end and do an exit. Just note that tick-10s will
> fire in about 10 sec and this is not exactly at 10s.
>
> Here is what you need to add.
>
> tick-10s
> {
>        exit(0);
> }
>
> -Angelo
>
> On Oct 19, 2009, at 12:39 PM, Roman Naumenko wrote:
>
>> Hello,
>>
>> I'm building some simple monitoring tools to watch zfs storage servers.
>>
>> Is this possible to run dtrace script for example 10 seconds? (Of course
>> it is, I just trying to figure out how). Right know it has to be stopped by
>> "CTRL-C"
>>
>> I'm particulary interested in scripts like iscsiio.d, iscsiwho.d from
>> http://www.solarisinternals.com/wiki/index.php/DTrace_Topics_iSCSI
>>
>> Thanks in advance,
>> Roman Naumenko
>> ro...@frontline.ca
>> --
>> This message posted from opensolaris.org
>> _______________________________________________
>> dtrace-discuss mailing list
>> dtrace-discuss@opensolaris.org
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org
>
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to