Class: RuntimeProfiler::Profiler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(constants) ⇒ Profiler

Returns a new instance of Profiler.



11
12
13
14
# File 'lib/runtime_profiler/profiler.rb', line 11

def initialize(constants)
  self.profiled_constants = constants
  prepare_for_profiling
end

Instance Attribute Details

#profiled_constantsObject

Returns the value of attribute profiled_constants.



9
10
11
# File 'lib/runtime_profiler/profiler.rb', line 9

def profiled_constants
  @profiled_constants
end

Instance Method Details

#profile!(key) ⇒ Object



16
17
18
19
# File 'lib/runtime_profiler/profiler.rb', line 16

def profile!(key)
  MethodMeter.measure!(key) { yield }
  save_profiling_data
end