Class: JvmGcGraph::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/jvm_gc_graph.rb

Class Method Summary collapse

Class Method Details

.output(parse_memory_log) ⇒ Object



20
21
22
23
24
25
# File 'lib/jvm_gc_graph.rb', line 20

def output(parse_memory_log)
  file = File.join(File.dirname(__FILE__),'templates','gc_chart.html.erb')
  template = File.read(File.expand_path(file))
  erb = ERB.new(template)
  erb.result(parse_memory_log.get_binding)
end

.run(opts) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/jvm_gc_graph.rb', line 9

def run(opts)
  pml = JvmGcGraph::ParseMemoryLog.new(opts)
  pml.json
  html = output(pml)
  if opts[:output].is_a?(IO)
    opts[:output].puts html
  else
    File.open(opts[:output],'w') {|f| f.write(html)}
  end
end