class BenchBloc::Logger::RubyProf

Public Instance Methods

log_results() click to toggle source
# File lib/bench_bloc/logger/ruby_prof.rb, line 4
def log_results
  formatted_results = BenchBloc::Formatter::RubyProf
                      .new(results, title)
                      .format_results
  write_to_log formatted_results
end
write_to_log(results) click to toggle source
# File lib/bench_bloc/logger/ruby_prof.rb, line 11
def write_to_log results
  if defined?(Rails)
    printer = ::RubyProf::FlatPrinter.new(results)
    File.open("#{Rails.root}/log/bench_bloc_ruby-prof.log", 'w') { |file|
      printer.print(file)
    }
  else
    printer = ::RubyProf::FlatPrinter.new(results)
    File.open("log/bench_bloc_ruby-prof.log", "w") { |file|
      printer.print(file)
    }
  end
end