[DTrace-devel] [PATCH 3/3] Ensure that BEGIN is the first probe and END the last one

Eugene Loh eugene.loh at oracle.com
Fri Sep 4 20:40:07 PDT 2020


On 09/04/2020 06:47 PM, Kris Van Hees wrote:

> On Fri, Sep 04, 2020 at 05:51:11PM -0700, Eugene Loh wrote:
>> On 08/27/2020 11:54 AM, Kris Van Hees wrote:
>>> DTrace semantics require that the BEGIN probe is the first one to be
>>> recorded in the trace buffers, and that the END probe is tha last one
>>> to be recorded in the trace buffers.  This is implemented using the
>>> activity member of the DTrace state that is shared using a BPF map.
>>>
>>> The default activity state is INACTIVE which means that no probe will
>>> processed except for the BEGIN probe.  The BEGIN probe will only be
>>> processed when the state is INACTIVE.
>>>
>>> Once the BEGIN probe processing has completed, the activity state is
>>> advanced to ACTIVE.  All probes other than BEGIN require the activity
>>> state to be ACTIVE in order for them to be processed.
>>> +/*
>>> + * DTrace activity state
>>> + */
>>> +typedef enum dt_activity {
>>> +	DT_ACTIVITY_INACTIVE = 0,	/* tracing not started */
>>> +	DT_ACTIVITY_ACTIVE,		/* tracing in progress */
>>> +	DT_ACTIVITY_DRAINING,		/* tracing being stopped */
>>> +	DT_ACTIVITY_STOPPED		/* tracing stopped */
>>> +} dt_activity_t;
>>> +
>> What is DT_ACTIVITY_STOPPED used for?  Another one of those "future
>> patch" things?
> It is the state at which tracing has been stopped.

Out of curiosity, is it used in a patch I would have seen by now, or in 
a patch that is yet to come?

>> Also, shouldn't there be a corresponding END test?
>> unittest/end/tst.end-last.* or so?
> No, because although we are enforcing that no probe firing will trigger the
> processing of clauses once we reach END, it is possible that a probe that fired
> prior to END getting triggered will not complete recording its trace data by
> the time END records trace data.
Okay.  I wouldn't mind a note to this effect in the commit message 
(which could reasonably mention the BEGIN test), but as you like.



More information about the DTrace-devel mailing list