See https://bugzilla.gnome.org/show_bug.cgi?id=606044 for a situation where semaphores constitute a performance regression. (In this case, argument setup is small compared to the semaphore value check.) Unless we can automate per-marker semaphore presence, we should provide an override capability. It may need to be nothing larger than allowing an application .c file to define #define STAP_NO_SEMAPHORES which then the dtrace.in-generated script would observe and avoid defining STAP_HAS_SEMAPHORES.
Why doesn't semaphores work like the is-enabled stuff in dtrace: http://blogs.sun.com/ahl/entry/user_land_tracing_gets_better Seems like that would be much more useful than automatically enabling it for all probes. And its dtrace compatible to boot.
(In reply to comment #1) > Why doesn't semaphores work like the is-enabled stuff in dtrace: Right, that foo_IS_ENABLED() is already supported as is. > Seems like that would be much more useful than automatically enabling it for all > probes. The argument has been that we've encountered cases where sdt.h macros were called with fairly heavy-weight arguments, but without an explicit foo_IS_ENABLED() wrapper. In these cases, it helped. But now there is evidence that it also hurts sometimes, so we need to re-evaluate.
I don't particularly care if semaphores are automatically enabled for probes or not, as long as there is a way to enable/disable it. For glib i want to disable it and do it manually where needed. This should imho be the right approach for all probe sets, but I realize not everyone need to be as careful about performance issues as core glib functionallity.
Created attachment 4811 [details] 0001-dtrace.in-Allow-definition-of-STAP_LIGHTWEIGHT_PROBE.patch Something like this (untested) patch?
Or maybe we should flip the default over to no-semaphores, and have a user specifically request it: -D STAP_SDT_IMPLICIT_SEMAPHORES (since they can already use foo_ENABLED() for explicit conditions).
I agree with frank. Additionally, thats what dtrace does.
commit: 954b1d89f8 I pretty much did the same thing as #4 except all the macro manipulation is in sdt.h so a program can be built either way without having to rerun dtrace.
flip the default