I added a couple of static probes to Firefox to measure actual work done. I could have used a pid$target probe with a function name but work is done within an if statement, which is where I placed the static probes. I''m wondering about my use, though. Is the following significantly more efficient than pid$target::FunName:entry and return? I heard somewhere that $target does not need to be used with static probes but the probes don''t show up unless Firefox is running and then only as mozillaNNNNN, i.e. mozilla$target. Thanks, Joel --- BEGIN { self->ts = 0; self->vts = 0; } mozilla$target:::process-xul-reflow-entry { self->ts = timestamp; self->vts = vtimestamp; self->roots = arg0; } mozilla$target:::process-xul-reflow-return /self->ts/ { this->ts = timestamp - self->ts; this->vts = vtimestamp - self->vts; printf("\n"); printf("# roots: %u\n", self->roots); printf("elapsed: %u.%06ums\n", this->ts / 1000000, this->ts % 1000000); printf("cpu : %u.%06ums\n", this->vts / 1000000, this->vts % 1000000); @tsint = sum(this->ts / 1000000); @tsfrac = sum(this->ts % 1000000); @vtsint = sum(this->vts / 1000000); @vtsfrac = sum(this->vts % 1000000); @n = count(); self->ts = 0; self->vts = 0; ustack(); } END { t = timestamp; printf("\n\n----------------------\n"); printa("elapsed: %@u.%@06ums\n", @tsint, @tsfrac); printa("cpu : %@u.%@06ums\n", @vtsint, @vtsfrac); printa("count : %@u times\n", @n); } --- fastest mac firefox! http://wagerlabs.com
On Wed, Sep 9, 2009 at 5:10 PM, Joel Reymont<joelr1 at gmail.com> wrote:> I added a couple of static probes to Firefox to measure actual work done. I > could have used a pid$target probe with a function name but work is done > within an if statement, which is where I placed the static probes. > > I''m wondering about my use, though. Is the following significantly more > efficient than pid$target::FunName:entry and return? >No, it''s not significantly more efficient. Both function entry/return probes and USDT probes involve replacing an instruction in the stream with a trap instruction. The expense of the trap into the kernel is going to overwhelm any subtleties in handling between the two different types of probes.> I heard somewhere that $target does not need to be used with static probes > but the probes don''t show up unless Firefox is running and then only as > mozillaNNNNN, i.e. mozilla$target. >Nope, you''ll need $target. Both the pid and USDT probes manipulate the target process, so they need some way of identifying that process. Chad
What about the expense of matching on the function name? You are saying that the kernel trap overwhelms that, right? On Sep 9, 2009, at 10:20 PM, Chad Mynhier wrote:> No, it''s not significantly more efficient. Both function entry/return > probes and USDT probes involve replacing an instruction in the stream > with a trap instruction. The expense of the trap into the kernel is > going to overwhelm any subtleties in handling between the two > different types of probes.--- fastest mac firefox! http://wagerlabs.com
To be more explicit, my concerns are about the effect of function name entry/return probes vs static probes on elapsed time, as measured by timestamp. I''m viewing all my timings as a percentage of total elapsed time and I''m wondering if there''s less overhead in using static probes in this context. Thanks, Joel On Sep 9, 2009, at 10:20 PM, Chad Mynhier wrote:> The expense of the trap into the kernel is > going to overwhelm any subtleties in handling between the two > different types of probes.--- fastest mac firefox! http://wagerlabs.com
On Sep 9, 2009, at 2:10 PM, Joel Reymont wrote:> I''m wondering about my use, though. Is the following significantly > more efficient than pid$target::FunName:entry and return?The cost of the actual probe firing is the same. The *eval-time* cost of finding out which probes exist and turning on the right ones is much faster in the USDT case.> > I heard somewhere that $target does not need to be used with static > probes but the probes don''t show up unless Firefox is running and > then only as mozillaNNNNN, i.e. mozilla$target. > > Thanks, Joel >You can wildcard the USDT probes: mozilla*:::process-xul-reflow-entry will match all existing processes with that probe, and any future ones that start up with that probe. James M