On Fri, Sep 11, 2009 at 5:28 AM, Ryan Johnson <ryanj...@ece.cmu.edu> wrote:
> Hi Hans-Peter,
>
> You're looking for the 'tick' provider, which for some reason is documented
> in the page for the 'profile' provider:
> http://wikis.sun.com/display/DTrace/profile+Provider.
>
> Basically, you want something like
>
> tick-10sec { exit(); }
>

The tick and profile providers are one and the same.  The difference
is that the tick provider fires on a single CPU while the profile
provider fires on multiple CPUs.

It's probably also worth noting that a tick-10sec probe isn't
guaranteed to fire after 10 seconds, it's guaranteed to fire some time
in the next 10 seconds.  Tick and profile probes use cyclics.  If
there's already an enabled tick-10sec probe on the server, i.e.,
there's an existing cyclic, DTrace won't create a new cyclic for this
script.  The existing one will be used, and you don't know when that
cyclic is going to fire.  The only thing you're guaranteed is that the
second and succeeding ones will fire at 10 seconds intervals.

The better way to do this (if it matters) is to use a tick-1sec probe
with a counter, like this:

BEGIN
{ counter = 0; }

tick-1sec
/ counter < 10 /
{ counter++; }

tick-1sec
/ counter >= 10 /
{ exit(0); }

This way, the script will run for somewhere between 9 and 10 seconds.

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

Reply via email to