On Mon, Jun 19, 2006 at 05:14:15PM -0400, Chris Browne wrote:
> Robert.Lor@Sun.COM (Robert Lor) writes:
> > For DTrace, probes can be enabled using a D script. When the probes
> > are not enabled, there is absolutely no performance hit whatsoever.
>
> That seems inconceivable.
>
> In order to have a way of deciding whether or not the probes are
> enabled, there has *got* to be at least one instruction executed, and
> that can't be costless.
I think the trick is that the probe are enabled by overwriting bits of
code. So by default you might put a No-Op instruction and if you want
to trace you replace that with an illegal instruction or the special
one-byte INT3 instruction x86 system have for this purpose.
With a 17-stage pipelined processor I imagine the cost of a no-op would
indeed be almost unmeasurable (increase code size I suppose).
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.