Class: DevSuite::Performance::Profiler::ExecutionTime

Inherits:
Base show all
Defined in:
lib/dev_suite/performance/profiler/execution_time.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Utils::Construct::Component::Base

component_key

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



7
8
9
# File 'lib/dev_suite/performance/profiler/execution_time.rb', line 7

def stats
  @stats
end

Instance Method Details

#run(&block) ⇒ Object



9
10
11
12
13
14
# File 'lib/dev_suite/performance/profiler/execution_time.rb', line 9

def run(&block)
  result = nil
  timing = ::Benchmark.measure { result = yield }
  @stats = calculate_stats(timing)
  result
end