Class: MethodProfiler::Profiler
- Inherits:
-
Object
- Object
- MethodProfiler::Profiler
- Defined in:
- lib/method_profiler/profiler.rb
Overview
Observes an object, keeping track of all its method calls and the wall clock time spent executing them.
Instance Method Summary collapse
-
#initialize(obj) ⇒ Profiler
constructor
Initializes a new Profiler.
-
#report ⇒ Report
Generates a report object with all the data collected so far bay the profiler.
Constructor Details
#initialize(obj) ⇒ Profiler
Initializes a new MethodProfiler::Profiler. Wraps all methods in the object and its singleton class with profiling code.
15 16 17 18 19 20 |
# File 'lib/method_profiler/profiler.rb', line 15 def initialize(obj) @obj = obj @data = Hash.new { |h, k| h[k] = [] } wrap_methods_with_profiling end |