Skip to content

Instantly share code, notes, and snippets.

Created September 12, 2011 22:43
Show Gist options
  • Save anonymous/1212690 to your computer and use it in GitHub Desktop.
Save anonymous/1212690 to your computer and use it in GitHub Desktop.
irb(main):009:0> require 'java'
=> false
irb(main):010:0> mf = Java::sun.management.ManagementFactory
=> Java::SunManagement::ManagementFactory
irb(main):011:0> hs_mem = mf.hotspot_memory_mbean
=> #<#<Class:0x3cbdb6ae>:0x7987b5ff>
irb(main):012:0> ctrs = hs_mem.internal_memory_counters
=> #<Java::JavaUtil::ArrayList:0x2e41dc79>
irb(main):013:0> ctrs.each {|x| puts "#{x.name} = #{x.value} #{x.units}"}
sun.gc.cause = No GC String
sun.gc.collector.0.invocations = 3 Events
sun.gc.collector.0.lastEntryTime = 145807491417 Ticks
sun.gc.collector.0.lastExitTime = 145825214152 Ticks
sun.gc.collector.0.name = PCopy String
sun.gc.collector.0.time = 43403561 Ticks
sun.gc.collector.1.invocations = 0 Events
sun.gc.collector.1.lastEntryTime = 0 Ticks
sun.gc.collector.1.lastExitTime = 0 Ticks
sun.gc.collector.1.name = CMS String
sun.gc.collector.1.time = 0 Ticks
sun.gc.generation.0.agetable.bytes.00 = 0 Bytes
sun.gc.generation.0.agetable.bytes.01 = 2161976 Bytes
sun.gc.generation.0.agetable.bytes.02 = 0 Bytes
sun.gc.generation.0.agetable.bytes.03 = 0 Bytes
sun.gc.generation.0.agetable.bytes.04 = 0 Bytes
sun.gc.generation.0.agetable.bytes.05 = 0 Bytes
sun.gc.generation.0.agetable.bytes.06 = 0 Bytes
sun.gc.generation.0.agetable.bytes.07 = 0 Bytes
sun.gc.generation.0.agetable.bytes.08 = 0 Bytes
sun.gc.generation.0.agetable.bytes.09 = 0 Bytes
sun.gc.generation.0.agetable.bytes.10 = 0 Bytes
sun.gc.generation.0.agetable.bytes.11 = 0 Bytes
sun.gc.generation.0.agetable.bytes.12 = 0 Bytes
sun.gc.generation.0.agetable.bytes.13 = 0 Bytes
sun.gc.generation.0.agetable.bytes.14 = 0 Bytes
sun.gc.generation.0.agetable.bytes.15 = 0 Bytes
sun.gc.generation.0.agetable.size = 16 None
sun.gc.generation.0.capacity = 21757952 Bytes
sun.gc.generation.0.maxCapacity = 65536000 Bytes
sun.gc.generation.0.minCapacity = 21757952 Bytes
sun.gc.generation.0.name = new String
sun.gc.generation.0.space.0.capacity = 17432576 Bytes
sun.gc.generation.0.space.0.initCapacity = 0 Bytes
sun.gc.generation.0.space.0.maxCapacity = 52428800 Bytes
sun.gc.generation.0.space.0.name = eden String
sun.gc.generation.0.space.0.used = 4588456 Bytes
sun.gc.generation.0.space.1.capacity = 2162688 Bytes
sun.gc.generation.0.space.1.initCapacity = 0 Bytes
sun.gc.generation.0.space.1.maxCapacity = 6553600 Bytes
sun.gc.generation.0.space.1.name = s0 String
sun.gc.generation.0.space.1.used = 0 Bytes
sun.gc.generation.0.space.2.capacity = 2162688 Bytes
sun.gc.generation.0.space.2.initCapacity = 0 Bytes
sun.gc.generation.0.space.2.maxCapacity = 6553600 Bytes
sun.gc.generation.0.space.2.name = s1 String
sun.gc.generation.0.space.2.used = 2162688 Bytes
sun.gc.generation.0.spaces = 3 None
sun.gc.generation.0.threads = 8 None
sun.gc.generation.1.capacity = 65404928 Bytes
sun.gc.generation.1.maxCapacity = 458752000 Bytes
sun.gc.generation.1.minCapacity = 65404928 Bytes
sun.gc.generation.1.name = old String
sun.gc.generation.1.space.0.capacity = 65404928 Bytes
sun.gc.generation.1.space.0.initCapacity = 65404928 Bytes
sun.gc.generation.1.space.0.maxCapacity = 458752000 Bytes
sun.gc.generation.1.space.0.name = old String
sun.gc.generation.1.space.0.used = 5716528 Bytes
sun.gc.generation.1.spaces = 1 None
sun.gc.generation.2.capacity = 24903680 Bytes
sun.gc.generation.2.maxCapacity = 85983232 Bytes
sun.gc.generation.2.minCapacity = 21757952 Bytes
sun.gc.generation.2.name = perm String
sun.gc.generation.2.space.0.capacity = 24903680 Bytes
sun.gc.generation.2.space.0.initCapacity = 21757952 Bytes
sun.gc.generation.2.space.0.maxCapacity = 85983232 Bytes
sun.gc.generation.2.space.0.name = perm String
sun.gc.generation.2.space.0.used = 24727344 Bytes
sun.gc.generation.2.spaces = 1 None
sun.gc.lastCause = unknown GCCause String
sun.gc.policy.collectors = 2 None
sun.gc.policy.desiredSurvivorSize = 1081344 Bytes
sun.gc.policy.generations = 3 None
sun.gc.policy.maxTenuringThreshold = 4 None
sun.gc.policy.name = ParNew:CMS String
sun.gc.policy.tenuringThreshold = 1 None
sun.gc.tlab.alloc = 2170726 Bytes
sun.gc.tlab.allocThreads = 2 None
sun.gc.tlab.fastWaste = 0 Bytes
sun.gc.tlab.fills = 51 None
sun.gc.tlab.gcWaste = 19604 Bytes
sun.gc.tlab.maxFastWaste = 0 Bytes
sun.gc.tlab.maxFills = 50 None
sun.gc.tlab.maxGcWaste = 19604 Bytes
sun.gc.tlab.maxSlowAlloc = 3 None
sun.gc.tlab.maxSlowWaste = 1716 Bytes
sun.gc.tlab.slowAlloc = 3 None
sun.gc.tlab.slowWaste = 1716 Bytes
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment