basho/riak_core — pull request #174 by slfritchie (2012-05-14 03:29:08+00:00)
Title: Slf dtrace take1

Add basic infrastructure Erlang-triggerable probes to Riak Core apps.

In an ideal world, this module would live in a repo that would be
easily sharable across multiple Basho projects. The tricky bit for
this would be trying to make generic the
`application:get_env(riak_core, dtrace_support)' call that's
currently in the `riak_kv_dtrace:dtrace/1' function. But we'll
wait for another day, I think.

The purpose of this module is to reduce the overhead of DTrace (and
SystemTap) probes when those probes are: 1. not supported by the VM,
or 2. disabled by application configuration. #1 is the bigger
problem: a single call to the code loader can take several
milliseconds. #2 is useful in the case that we want to try to reduce
the overhead of adding these probes even further by avoiding the NIF
call entirely.

SLF's MacBook Pro tests

without cover, with R14B04 + DTrace:

timeit_naive average 2236.306 usec/call over 500.0 calls
timeit_mochiglobal average 0.509 usec/call over 225000.0 calls
timeit_best OFF (fastest) average 0.051 usec/call over 225000.0 calls
timeit_best ON -init average 1.027 usec/call over 225000.0 calls
timeit_best ON +init average 0.202 usec/call over 225000.0 calls

with cover, with R14B04 + DTrace:

timeit_naive average 2286.202 usec/call over 500.0 calls
timeit_mochiglobal average 1.255 usec/call over 225000.0 calls
timeit_best OFF (fastest) average 1.162 usec/call over 225000.0 calls
timeit_best ON -init average 2.207 usec/call over 225000.0 calls
timeit_best ON +init average 1.303 usec/call over 225000.0 calls