I have a point in my program where a timer is set up to fire as soon as possible and another where it actually fires. This sequence happens several times. I would like to collect the functions triggered between the timer being set up and the timer firing since this would tell me what''s delaying the firing of the timer. I suppose I can just print the probe functions but I would also like the ability to discard them whenever a timer gets cancelled. I would like to keep only the trace leading to the timer actually firing. What is the best way to accumulate the probefuncs keyed on the sequence id (0, 1, 2,...) and discard them if the timer is cancelled? Thanks, Joel --- fastest mac firefox! http://wagerlabs.com
Angelo Rajadurai
2009-Oct-02 13:36 UTC
[dtrace-discuss] accumulating and discarding traces
You may want to look at speculative tracing. This designed just for this purpose http://wikis.sun.com/display/DTrace/Speculative+Tracing -Angelo On Oct 2, 2009, at 9:29 AM, Joel Reymont wrote:> I have a point in my program where a timer is set up to fire as soon > as possible and another where it actually fires. This sequence > happens several times. > > I would like to collect the functions triggered between the timer > being set up and the timer firing since this would tell me what''s > delaying the firing of the timer. > > I suppose I can just print the probe functions but I would also like > the ability to discard them whenever a timer gets cancelled. I would > like to keep only the trace leading to the timer actually firing. > > What is the best way to accumulate the probefuncs keyed on the > sequence id (0, 1, 2,...) and discard them if the timer is cancelled? > > Thanks, Joel > > --- > fastest mac firefox! > http://wagerlabs.com > > > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
On Oct 2, 2009, at 2:36 PM, Angelo Rajadurai wrote:> You may want to look at speculative tracing. This designed just for > this purposeI''m a bit stumped, though. Consider this script below. I would like to print statistics when the timer fires but it looks like I cannot have commit in that clause since I get errors like dtrace: failed to compile script reflow-timer.d: line 32: data- recording actions may not follow commit( ) and dtrace: failed to compile script reflow-timer.d: line 31: commit( ) may not follow data-recording action(s) Can I have my cake and eat it too? Do I have to put the printing in a separate script? Thanks, Joel --- mozilla$target:::reflow-timer-init { self->init = timestamp; self->spec = speculation(); speculate(self->spec); printf(">>> reflow timer initialized at %u to fire in %ums\n", self- >init, arg0); } pid$target:::entry /self->spec/ { speculate(self->spec); printf("%s\n", probefunc); } mozilla$target:::reflow-timer-cancel /self->spec/ { discard(self->spec); self->spec = 0; printf(">>> reflow timer cancelled\n"); } mozilla$target:::reflow-timer-fire /self->spec/ { self->start = timestamp; self->elapsed = self->start - self->init; printf(">>> reflow timer fired at %u, after %u.%06ums\n", self->start, self->elapsed / 1000000, self->elapsed % 1000000); commit(self->spec); self->spec = 0; } --- fastest mac firefox! http://wagerlabs.com
Angelo Rajadurai
2009-Oct-02 14:06 UTC
[dtrace-discuss] accumulating and discarding traces
Hey Joel: Can you just split the last probe/action ? I have not tested it myself and I''m making the recommendation based on the example in the doc. Can you do something like mozilla$target:::reflow-timer-init { self->init = timestamp; self->spec = speculation(); speculate(self->spec); printf(">>> reflow timer initialized at %u to fire in %ums\n", self- >init, arg0); } pid$target:::entry /self->spec/ { speculate(self->spec); printf("%s\n", probefunc); } mozilla$target:::reflow-timer-cancel /self->spec/ { discard(self->spec); self->spec = 0; printf(">>> reflow timer cancelled\n"); } mozilla$target:::reflow-timer-fire /self->spec/ { self->start = timestamp; self->elapsed = self->start - self->init; printf(">>> reflow timer fired at %u, after %u.%06ums\n", self->start, self->elapsed / 1000000, self->elapsed % 1000000); } mozilla$target:::reflow-timer-fire /self->spec/ { commit(self->spec); self->spec = 0; } On Oct 2, 2009, at 9:52 AM, Joel Reymont wrote:> > On Oct 2, 2009, at 2:36 PM, Angelo Rajadurai wrote: > >> You may want to look at speculative tracing. This designed just for >> this purpose > > I''m a bit stumped, though. Consider this script below. I would like > to print statistics when the timer fires but it looks like I cannot > have commit in that clause since I get errors like > > dtrace: failed to compile script reflow-timer.d: line 32: data- > recording actions may not follow commit( ) > > and > > dtrace: failed to compile script reflow-timer.d: line 31: commit( ) > may not follow data-recording action(s) > > Can I have my cake and eat it too? Do I have to put the printing in > a separate script? > > Thanks, Joel > > --- > > mozilla$target:::reflow-timer-init > { > self->init = timestamp; > self->spec = speculation(); > speculate(self->spec); > printf(">>> reflow timer initialized at %u to fire in %ums\n", self- > >init, arg0); > } > > pid$target:::entry > /self->spec/ > { > speculate(self->spec); > printf("%s\n", probefunc); > } > > mozilla$target:::reflow-timer-cancel > /self->spec/ > { > discard(self->spec); > self->spec = 0; > printf(">>> reflow timer cancelled\n"); > } > > mozilla$target:::reflow-timer-fire > /self->spec/ > { > self->start = timestamp; > self->elapsed = self->start - self->init; > printf(">>> reflow timer fired at %u, after %u.%06ums\n", > self->start, self->elapsed / 1000000, self->elapsed % 1000000); > commit(self->spec); > self->spec = 0; > } > > --- > fastest mac firefox! > http://wagerlabs.com > > > >
max at bruningsystems.com
2009-Oct-02 14:07 UTC
[dtrace-discuss] accumulating and discarding traces
Hi Joel, Joel Reymont wrote:> > On Oct 2, 2009, at 2:36 PM, Angelo Rajadurai wrote: > >> You may want to look at speculative tracing. This designed just for >> this purpose > > I''m a bit stumped, though. Consider this script below. I would like to > print statistics when the timer fires but it looks like I cannot have > commit in that clause since I get errors like > > dtrace: failed to compile script reflow-timer.d: line 32: > data-recording actions may not follow commit( ) > > and > > dtrace: failed to compile script reflow-timer.d: line 31: commit( ) > may not follow data-recording action(s) > > Can I have my cake and eat it too? Do I have to put the printing in a > separate script?You don''t need a separate script. You should use your "mozilla$target:::reflow-timer-fire" probe twice. In the first clause, do the data recording, and in the second, do the commit. max> > Thanks, Joel > > --- > > mozilla$target:::reflow-timer-init > { > self->init = timestamp; > self->spec = speculation(); > speculate(self->spec); > printf(">>> reflow timer initialized at %u to fire in %ums\n", > self->init, arg0); > } > > pid$target:::entry > /self->spec/ > { > speculate(self->spec); > printf("%s\n", probefunc); > } > > mozilla$target:::reflow-timer-cancel > /self->spec/ > { > discard(self->spec); > self->spec = 0; > printf(">>> reflow timer cancelled\n"); > } > > mozilla$target:::reflow-timer-fire > /self->spec/ > { > self->start = timestamp; > self->elapsed = self->start - self->init; > printf(">>> reflow timer fired at %u, after %u.%06ums\n", > self->start, self->elapsed / 1000000, self->elapsed % 1000000); > commit(self->spec); > self->spec = 0; > } > > --- > fastest mac firefox! > http://wagerlabs.com > > > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >