Class: DevSuite::Performance::Profiler::Memory

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

component_key

Constructor Details

#initializeMemory

Returns a new instance of Memory.



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

def initialize
  super
  @memory_usage = Data::MemoryUsage.new
  @memory_points = []
end

Instance Attribute Details

#statsObject (readonly)

Returns the value of attribute stats.



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

def stats
  @stats
end

Instance Method Details

#run(&block) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/dev_suite/performance/profiler/memory.rb', line 15

def run(&block)
  before_memory = record_memory
  result = yield
  after_memory = record_memory

  @stats = calculate_stats(before_memory, after_memory)
  result
end