Sha256: 84306a769e66d42c0163024fee85cd86f7f68b4bae6c354dc694684c754a2295

Contents?: true

Size: 577 Bytes

Versions: 11

Compression:

Stored size: 577 Bytes

Contents

#!/usr/bin/env jruby
require 'rubygems'
require 'jmx4r'

def display header, memory_usage
  puts header
  memory_usage.sort.each do |key, value|
    puts "\t#{key} : #{value}"
  end
end
memory = JMX::MBean.find_by_name "java.lang:type=Memory"

display "Heap Memory Usage", memory.heap_memory_usage
display "Non Heap Memory Usage", memory.non_heap_memory_usage

if ARGV.length == 1 and ARGV[0] == "gc"
  puts "trigger a garbage collection"
  memory.gc
  display "Heap Memory Usage", memory.heap_memory_usage
  display "Non Heap Memory Usage", memory.non_heap_memory_usage   
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
weblogic-jmx4r-0.1.9 examples/memory.rb
jmx4r-0.1.4 examples/memory.rb
jmx4r-0.1.3 examples/memory.rb
jmx4r-0.1.2 examples/memory.rb
jmx4r-0.1.1 examples/memory.rb
jmx4r-0.1.0 examples/memory.rb
jmx4r-0.0.8 examples/memory.rb
jmx4r-0.0.6 examples/memory.rb
jmx4r-0.0.4 examples/memory.rb
jmx4r-0.0.5 examples/memory.rb
jmx4r-0.0.7 examples/memory.rb