/ruby_sampling_profiler

Randomized Sampling Profiler for Ruby

MIT LicenseMIT

Ruby Randomized Sampling Profiler

Build Status

The patches here implement modifications to Ruby's source code to add a randomized sampling profiler.

Supported Versions

The subdirectories contain the patch file for that version of Ruby.

Controlling The Sampler

The profiler is enabled by setting the RUBY_PROFILER environmental variable. The value is not significant.

The sampling "tick" value defaults to 5 milliseconds and can be set in nanoseconds by setting RUBY_PROFILER_TICK. The value cannot be set to less than 5 milliseconds.

The profiler can emit data about its functioning. Set the RUBY_PROFILER_STATS value to the name of a file. The file is formatted as a CSV with the following columns:

PID, sample, random, random_percent, delta_sec, delta_nsec, delta_nsec_percent
  1. PID - this enables distinguishing parent from child process stats
  2. sample - the sample index
  3. random - the random delta to the sample interval
  4. random_percent - the percentage of the sample interval represented by the random delta
  5. delta_sec - the delta between the value of the second set for the interval and the measured second when the sampler thread wakes up
  6. delta_nsec - the delta between the value of the nanosecond set for the interval and the measured nanosecond when the sampler thread wakes up
  7. delta_nsec_percent - the percentage of the sample interval represented by the delta_nsec.

Building

Using ruby-install

For information about using ruby-install, see the ruby-install docs

$ ruby-install -p https://raw.githubusercontent.com/brixen/ruby_sampling_profiler/master/ruby-2.1/profiler.diff ruby 2.1.10

Using ruby-build

For information about using rbenv and ruby-build, see the ruby-build docs.

$ rbenv install --patch 2.1.10 < <(curl -sSL https://raw.githubusercontent.com/brixen/ruby_sampling_profiler/master/ruby-2.1/profiler.diff)

Using RVM

For information about using rvm, see the RVM docs.

$ rvm install 2.1.10 --patch https://raw.githubusercontent.com/brixen/ruby_sampling_profiler/master/ruby-2.1/profiler.diff

References

  1. Evaluating the Accuracy of Java Profilers
  2. Statistically Rigorous Java Performance Evaluation

License

See LICENSE