diff --git a/performance/profile.rb b/performance/profile.rb index 57b6187..1feba24 100644 --- a/performance/profile.rb +++ b/performance/profile.rb @@ -8,10 +8,17 @@ profiler.run [:cpu, :object].each do |profile_type| puts "Profiling in #{profile_type.to_s} mode..." results = StackProf.run(mode: profile_type) do - 100.times do + 200.times do profiler.run end end + + if profile_type == :cpu && graph_filename = ENV['GRAPH_FILENAME'] + File.open(graph_filename, 'w') do |f| + StackProf::Report.new(results).print_graphviz(nil, f) + end + end + StackProf::Report.new(results).print_text(false, 20) File.write(ENV['FILENAME'] + "." + profile_type.to_s, Marshal.dump(results)) if ENV['FILENAME'] end