[dtrace-discuss] run for cmd-line specified time ?

Peter Lawrence
Tue, 15 May 2007 18:22:27 -0000

Bryan,
      I''m probably mis-reading this, but here''s what it says
on your
<dtrace.eng/usage.html>


END. Probe triggered after tracing has stopped due to an explicit termination of
tracing from the DTrace consumer. When using dtrace(1M), the END probe is
triggered after receipt of a SIGINT or SIGTERM (e.g., ^C). The END probe is not
triggered after an exit action.


perhaps its the "exit action" that I''m making assumptions
about...?...


-Pete.














 Cantrill wrote On 05/14/07 09:23 PM,:
> On Mon, May 14, 2007 at 08:47:10PM -0700, Peter Lawrence wrote:
>
>>I''ld like to be able to run my dtrace program for an amount of
seconds
>>that I give as a command line argument, is there a standard cut-n-paste
>>boilerplate method for this...?...   I can pass the amount at the end of
the
>>command-line, and within my dtrace program it will be available as
"$1",
>>but then what kind of probe can I write that will fire at $1 seconds
plus
>>the BEGIN time, and will cause all my END probes to fire.
>
>
> 	tick-1sec
> 	/i++ == $1/
> 	{
> 		exit(0);
> 	}
>
>
>
>>what I don''t want to do is have a probe that calls exit(),
because the
>>docs say that the END probes will not be invoked in this case, but
>>I have END probes sprinkled throughout my program, which is a
concatentaion
>>of a lot of mostly separate programs, hence I need the END probes to
>>trigger.
>
>
> What docs are you looking at?  Calling exit() causes END to fire -- and
> has for a long, long time.  From the exit() subsection of the Special
Actions
> section of the "Actions and Subroutines" chapter:
>
>   When exit() is called, only DTrace actions already underway on other
>   CPUs will be taken; no subsequent actions will be taken on any CPU.
>   The only exception to this is the END probe, which will be called after
>   the DTrace consumer has processed the exit() action and indicated that
>   tracing should stop.
>
> 	- Bryan
>
> --------------------------------------------------------------------------
> Bryan Cantrill, Solaris Kernel Development.       http://blogs.sun.com/bmc