lib/flamegraph.rb in flamegraph-0.1.0 vs lib/flamegraph.rb in flamegraph-0.9.5

- old
+ new

@@ -9,16 +9,19 @@ end else begin require "fast_stack" rescue LoadError - STDERR.puts "Please require the fast_stack gem, note flamegraph is only supported on Ruby 2.0 and above" + unless RUBY_PLATFORM == 'java' + STDERR.puts "Please require the fast_stack gem, note flamegraph is only supported on Ruby 2.0 and above" + end end end require "flamegraph/version" require "flamegraph/renderer" +require "flamegraph/sampler" module Flamegraph def self.generate(filename=nil, opts = {}) fidelity = opts[:fidelity] || 0.5 @@ -26,11 +29,15 @@ if defined? StackProf require "flamegraph/stackprof_sampler" unless defined? StackProfSampler StackProfSampler.collect(fidelity) do yield end - else + elsif defined? FastStack FastStack.profile(fidelity) do # , opts[:mode] || :ruby) do + yield + end + else + Sampler.collect(fidelity) do yield end end embed_resources = (filename && !opts.key?(:embed_resources)) || opts[:embed_resources]