capture engine ref_count question

Chris Johns chrisj at
Wed Aug 27 00:39:56 UTC 2014

On 27/08/2014 3:50 am, Jennifer Averett wrote:
>  > We suggest to remove the ref_count of the task structures to save
>  > time and locking. Otherwise we need atomic counters here?

You need a means of tracking the logged references to the task data in 
the trace log. The log can exist well past the life time of the task and 
the data.

>  > We suggest to free task structures when reading, by recording time of
>  > task deletion event we know when last event referencing the task
> occurred,

I do not like this approach.

>  > when that time have passed it should be okay to free the task structure?
> Can anyone see a problem with this.   My question is will this always
> work based on the zombie state of the thread?  I thought I saw

You cannot remove the ref_counts without an equivalent. The data is 
referenced beyond the life of a task.

Another approach could involve adding the task data to the trace buffer 
when the first reference to the task is added to the trace buffer. You 
would add the task data tagging it with some sort of "id". When added 
events related to the task the "id" is used. The trace buffer decoder 
extracts the task data building a suitable table to decode the following 
"id" references. There is a small extra bump filling the trace buffer 
with the task details but this is the cost of tracing in software. This 
approach helps solves the problem of off board streaming of the trace data.


More information about the devel mailing list