public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Dynamically enabling/disabling probe points from within stap script
@ 2009-11-20 21:53 James Y Knight
  2009-11-20 22:47 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: James Y Knight @ 2009-11-20 21:53 UTC (permalink / raw)
  To: systemtap

Is there any plan to allow the ability to dynamically and efficiently enable and disable probes from within the systemtap script?

I know you can do:
  probe process(...).mark("foo") if (whatever) {}
but that isn't efficient: there's still substantial overhead at the mark point as long as 'stap' is running, even if you aren't interested in that probe currently. (The overhead appears to be about 3µs per mark hit, on my machine.)

I saw some code in sdt.h about "semaphores", but that seems to just be an alternative to editing memory to insert a break instruction, and not a way to let the systemtap script temporarily disable probe points?

Also nice would be a way to (efficiently!) say "run this probe every N times the location is hit".

James

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Dynamically enabling/disabling probe points from within stap script
  2009-11-20 21:53 Dynamically enabling/disabling probe points from within stap script James Y Knight
@ 2009-11-20 22:47 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2009-11-20 22:47 UTC (permalink / raw)
  To: James Y Knight; +Cc: systemtap

James Y Knight <foom@fuhm.net> writes:

> Is there any plan to allow the ability to dynamically and
> efficiently enable and disable probes from within the systemtap
> script?

Yup.

> I know you can do:
>   probe process(...).mark("foo") if (whatever) {}
> but that isn't efficient [...]

That's right.  We have had a rough design for this, but kind of forgot
to finish the job.  Your note and PR10995 should bring attention back
to the problem.  (One drawback of actually disarming/rearming probes
is that because of the unavoidable latency between intended rearming
and actual rearming, the script may experience unknown missed probes.)

> Also nice would be a way to (efficiently!) say "run this probe every
> N times the location is hit".

Since this would require counting each location hit, and thus the
activation of the corresponding low-level probe, this would be
equivalent to adding something like this into the probe handler

           if (count++ % 100) next;

- FChE

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-20 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-20 21:53 Dynamically enabling/disabling probe points from within stap script James Y Knight
2009-11-20 22:47 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).