class TestProf::RubyProf::Report
Wrapper over RubyProf
profiler and printer
Public Class Methods
new(profiler)
click to toggle source
# File lib/test_prof/ruby_prof.rb, line 93 def initialize(profiler) @profiler = profiler end
Public Instance Methods
dump(name)
click to toggle source
Stop profiling and generate the report using provided name.
# File lib/test_prof/ruby_prof.rb, line 99 def dump(name) result = @profiler.stop printer_type, printer_class = config.resolve_printer if %w[call_tree multi].include?(printer_type) path = TestProf.create_artifact_dir printer_class.new(result).print( path: path, profile: "#{RubyProf::Configuration::LOGFILE_PREFIX}-#{printer_type}-" \ "#{config.mode}-#{name}", min_percent: config.min_percent ) else path = build_path name, printer_type File.open(path, "w") do |f| printer_class.new(result).print(f, min_percent: config.min_percent) end end log :info, "RubyProf report generated: #{path}" end
Private Instance Methods
build_path(name, printer)
click to toggle source
# File lib/test_prof/ruby_prof.rb, line 125 def build_path(name, printer) TestProf.artifact_path( "#{RubyProf::Configuration::LOGFILE_PREFIX}-#{printer}-#{config.mode}-#{name}" \ ".#{RubyProf::Configuration::PRINTER_EXTENSTION.fetch(printer, "txt")}" ) end
config()
click to toggle source
# File lib/test_prof/ruby_prof.rb, line 132 def config RubyProf.config end