Andrew Gallatin writes:
> Is it possible to write a dtrace script which can tell me the number of
> mblks, and total chain length, upon entry to a function (gldv3 nic driver's
> xmit function). I naively tried to iterate over mp->b_cont, but there is no
> while or for in dtrace..
Dtrace intentionally doesn't have looping -- for safety reasons.
> Eg, what I want to do is:
>
> for (pkt_size=0, count=0,bp = mp; bp != NULL; bp = bp->b_cont) {
You could do something like this:
fbt:mymodule:myfunc:entry
/arg1 != 0/
{
this->mp = (mblk_t *)arg1;
this->size = this->mp->b_wptr - this->mp->b_rptr;
}
fbt:mymodule:myfunc:entry
/this->mp && this->mp->b_cont/
{
this->mp2 = this->mp->b_cont;
this->size += this->mp2->b_wptr - this->mp2->b_rptr;
}
fbt:mymodule:myfunc:entry
/this->mp2 && this->mp2->b_cont/
{
this->mp3 = this->mp2->b_cont;
this->size += this->mp3->b_wptr - this->mp3->b_rptr;
}
.... and repeat a few times to catch as many cases as you feel is
necessary. (Perhaps add an assertion at the end to make sure you run
out of b_conts in all of the cases of interest.)
--
James Carlson, Solaris Networking <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
_______________________________________________
dtrace-discuss mailing list
[email protected]