Class: TestProf::RubyProf::Report
- Inherits:
-
Object
- Object
- TestProf::RubyProf::Report
- Includes:
- Logging
- Defined in:
- lib/test_prof/ruby_prof.rb
Overview
Wrapper over RubyProf profiler and printer
Constant Summary
Constants included from Logging
Instance Method Summary collapse
-
#dump(name) ⇒ Object
Stop profiling and generate the report using provided name.
-
#initialize(profiler) ⇒ Report
constructor
A new instance of Report.
Methods included from Logging
Constructor Details
#initialize(profiler) ⇒ Report
Returns a new instance of Report.
114 115 116 |
# File 'lib/test_prof/ruby_prof.rb', line 114 def initialize(profiler) @profiler = profiler end |
Instance Method Details
#dump(name) ⇒ Object
Stop profiling and generate the report using provided name.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/test_prof/ruby_prof.rb', line 120 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 |