Module: Kernel
- Defined in:
- lib/easy_prof.rb
Instance Method Summary collapse
-
#easy_profiler(name, options = {}) ⇒ Object
Wraps code block into the profiling session.
Instance Method Details
#easy_profiler(name, options = {}) ⇒ Object
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
46 47 48 49 50 51 |
# File 'lib/easy_prof.rb', line 46 def easy_profiler(name, = {}) profiler = EasyProfiler::Profile.start(name, ) yield profiler ensure EasyProfiler::Profile.stop(name) if profiler end |