class Corn::Profiler

Public Class Methods

new(post_interval, sampling_interval) click to toggle source
# File lib/corn/profiler.rb, line 6
def initialize(post_interval, sampling_interval)
  @post = Post.new(post_interval)
  @prof = SamplingProf.new(sampling_interval)
  at_exit { terminate }
end

Public Instance Methods

profile(handler, &block) click to toggle source
# File lib/corn/profiler.rb, line 12
def profile(handler, &block)
  @prof.profile(lambda {|data| @post.enqueue(handler.call(data))}, &block)
end
terminate() click to toggle source
# File lib/corn/profiler.rb, line 16
def terminate
  @prof.terminate rescue nil
  @post.terminate rescue nil
end