Sha256: 2d50f01970053b80c6f19a855395a6b0bab45154e472f6cfa832fe8da7324efc

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 Bytes

Contents

require "json"
require "flamegraph/version"
require "flamegraph/sampler"
require "flamegraph/renderer"

module Flamegraph
  def self.generate(filename=nil)
    sampler = Flamegraph::Sampler.new
    sampler.start
    yield
    results = sampler.finish

    renderer = Flamegraph::Renderer.new(results)
    result = renderer.graph_html

    if filename
      File.open(filename,"w") do |f|
        f.write(result)
      end
    end
    result
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flamegraph-0.0.1 lib/flamegraph.rb