Class: MemoryTracker::Stores::InMemoryStore::StatInterval

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/memory_tracker/stores/in_memory_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_time, duration_seconds) ⇒ StatInterval

Returns a new instance of StatInterval.



43
44
45
46
47
48
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 43

def initialize(start_time, duration_seconds)
  @start_time = start_time
  @duration   = duration_seconds
  @size       = 0
  @stats = Stats.new
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



36
37
38
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 36

def duration
  @duration
end

#sizeObject (readonly)

Returns the value of attribute size.



36
37
38
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 36

def size
  @size
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



36
37
38
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 36

def start_time
  @start_time
end

#statsObject (readonly)

Returns the value of attribute stats.



36
37
38
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 36

def stats
  @stats
end

Instance Method Details

#push(request) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 50

def push(request)
  @size += 1
  delta = request.gcstat_delta.stats
  @stats.increment_action_count(request.controller, request.action)
  delta.each_key do |attr|
    @stats.increment_action_attribute(request.controller, request.action, attr, delta[attr])
  end
end