Quantize a probe only if it has a particular function in its stack.

Robert Mustacchi rm at joyent.com
Thu Jun 18 00:24:10 UTC 2015


On 6/17/15 17:21 , Priyank Sanghavi wrote:
> Hello,
> 
> I am currently working on dtrace on free-bsd. What I want to do is put a probe on uma_zalloc function and quantize its arguments.  But along with that I want to keep a condition to quantize ( or record the readings) only if the stack of that uma_zalloc has a function ( foo ) in it. —— This means, consider the readings of uma_zalloc only if it has come from the function foo. 
> 
> Is there a condition that can do that work?

Just use a thread local variable that tracks when you enter the function
you care about and removes it when you return. eg. if you had a function
called foobar:

fbt::foobar:entry
{
        self->t = 1;
}

fbt::foobar:return
{
        self->t = 0;
}

Then you can use that as a predicate on an enabling of uma_zalloc.

Robert



More information about the freebsd-dtrace mailing list