Class: TimeBandits::TimeConsumers::JMX

Inherits:
Object
  • Object
show all
Defined in:
lib/time_bandits/time_consumers/jmx.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



22
23
24
# File 'lib/time_bandits/time_consumers/jmx.rb', line 22

def self.instance
  @instance ||= new
end

Instance Method Details

#allocated_objectsObject



69
70
71
# File 'lib/time_bandits/time_consumers/jmx.rb', line 69

def allocated_objects
  0
end

#collections_deltaObject



53
54
55
# File 'lib/time_bandits/time_consumers/jmx.rb', line 53

def collections_delta
  gc_collections - @collections
end

#consumedObject



26
27
28
# File 'lib/time_bandits/time_consumers/jmx.rb', line 26

def consumed
  0.0
end

#gc_collectionsObject



34
35
36
# File 'lib/time_bandits/time_consumers/jmx.rb', line 34

def gc_collections
  @collectors.to_array.map {|gc| @server[gc].collection_count}.sum
end

#gc_timeObject



30
31
32
# File 'lib/time_bandits/time_consumers/jmx.rb', line 30

def gc_time
  @collectors.to_array.map {|gc| @server[gc].collection_time}.sum
end

#gc_time_deltaObject



57
58
59
# File 'lib/time_bandits/time_consumers/jmx.rb', line 57

def gc_time_delta
  (gc_time - @consumed).to_f
end

#heap_growthObject



61
62
63
# File 'lib/time_bandits/time_consumers/jmx.rb', line 61

def heap_growth
  heap_size - @heap_committed
end

#heap_sizeObject



38
39
40
# File 'lib/time_bandits/time_consumers/jmx.rb', line 38

def heap_size
  @memory_bean.heap_memory_usage.committed
end

#heap_usageObject



42
43
44
# File 'lib/time_bandits/time_consumers/jmx.rb', line 42

def heap_usage
  @memory_bean.heap_memory_usage.used
end

#resetObject



46
47
48
49
50
51
# File 'lib/time_bandits/time_consumers/jmx.rb', line 46

def reset
  @consumed = gc_time
  @collections = gc_collections
  @heap_committed = heap_size
  @heap_used = heap_usage
end

#runtimeObject



73
74
75
# File 'lib/time_bandits/time_consumers/jmx.rb', line 73

def runtime
  "GC: %.3f(%d), HP: %d(%d,%d,%d)" % [gc_time_delta, collections_delta, heap_growth, heap_size, allocated_objects, usage_growth]
end

#usage_growthObject



65
66
67
# File 'lib/time_bandits/time_consumers/jmx.rb', line 65

def usage_growth
  heap_usage - @heap_used
end