[dtrace-discuss] Re: Re: Combining Two providers

Chip Bennett cbennett at laurustech.com
Sat Feb 3 16:30:25 PST 2007


Neelam wrote:
> I think I understand what you are saying Chip..you haven't confused me..
>
> it's fine that every process/thread has it's own copy of local variables..but how do i distinguish between those threads/processes?
>   
That depends on what you're doing.  Let's take some examples:

If you're just saving a timestamp to be referenced later (so that you 
can calculate the delta), you just put the timestamp in a thread-local 
variable.  When that thread does the time calculation later, in a 
different probe clause, it will pick up the right one by virtue of the 
fact that it's the only instance of the variable that the thread can see.

If you're doing aggregations (which are global), use the "pid" and "tid" 
built-in variables as aggregation keys.

If you're creating you're own associative arrays for collecting data, 
again you can use the pid and tid variables as keys.

Chip


More information about the dtrace-discuss mailing list