module Kernel
Public Instance Methods
easy_profiler(name, options = {}) { |profiler| ... }
click to toggle source
Wraps code block into the profiling session.
See the EasyProfiler::Profile.start
method for parameters description.
Example:
easy_profiler('sleep', :enabled => true) do |p| sleep 1 p.progress('sleep 1') p.debug('checkpoint reached') sleep 2 p.progress('sleep 2') end
# File lib/easy_prof.rb, line 46 def easy_profiler(name, options = {}) profiler = EasyProfiler::Profile.start(name, options) yield profiler ensure EasyProfiler::Profile.stop(name) if profiler end