Discussion:
condition probe argument construction in static probes
Thomas Maier-Komor
2010-07-16 14:39:21 UTC
Permalink
Hi,

is it somehow possible to conditionally enable a section of code that is responsible for constructing a probe argument.

I.e. if the first probe argument is a string, can I attach a function to the probe that will yield that string so that it doesn't have to be constructed if the probe doesn't fire?

Defining the following probe yields assembly that executes the call to expensive_argument_construction unconditionally...

DTRACE_PROBE1(myprovider,myprobe,expensive_argument_construction());

- Thomas
--
This message posted from opensolaris.org
Chad Mynhier
2010-07-16 14:46:44 UTC
Permalink
I think you're looking for is-enabled probes. See
http://blogs.sun.com/ahl/entry/user_land_tracing_gets_better or the
current DTrace documentation.

Chad

On Fri, Jul 16, 2010 at 10:39 AM, Thomas Maier-Komor
Post by Thomas Maier-Komor
Hi,
is it somehow possible to conditionally enable a section of code that is responsible for constructing a probe argument.
I.e. if the first probe argument is a string, can I attach a function to the probe that will yield that string so that it doesn't have to be constructed if the probe doesn't fire?
Defining the following probe yields assembly that executes the call to expensive_argument_construction unconditionally...
DTRACE_PROBE1(myprovider,myprobe,expensive_argument_construction());
- Thomas
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
Thomas Maier-Komor
2010-07-19 11:08:38 UTC
Permalink
yes, that is what I was looking for and what I found myself before reading your e-mail. Your answer just came unexpectedly quick.

Thanks anyway!

Cheers,
Thomas
--
This message posted from opensolaris.org
Thomas Maier-Komor
2010-07-16 14:58:21 UTC
Permalink
replying to myself...

dtrace -h and <provider>_<probe>_ENABLED() seems to be the clue

This still yields a clear register -> nops -> jump-conditionally assembler sequence. But this is almost zero overhead...

Or is there anything better?

- Thomas
--
This message posted from opensolaris.org
Loading...