Class: MotionProfiler::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-profiler/profiler.rb

Overview

Velocity::Profiler collects execution time of method calls of an object.

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Profiler

Initializes a new Profiler to observe the given object.



7
8
9
10
11
12
# File 'lib/motion-profiler/profiler.rb', line 7

def initialize(obj)
  @obj = obj
  @data = Hash.new { |h, k| h[k] = [] }

  wrap_methods_with_profiling(self)
end

Instance Method Details

#reportObject

Returns a report of the profile data collected on the object.



15
16
17
# File 'lib/motion-profiler/profiler.rb', line 15

def report
  Report.new(final_data, @obj.name)
end