Module: TestProf::FactoryProf::Printers::Simple
- Extended by:
- Logging
- Defined in:
- lib/test_prof/factory_prof/printers/simple.rb
Overview
:nodoc: all
Constant Summary
Constants included from Logging
Class Method Summary collapse
Methods included from Logging
Class Method Details
.dump(result) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/test_prof/factory_prof/printers/simple.rb', line 9 def dump(result) return log(:info, "No factories detected") if result.raw_stats == {} msgs = [] total_count = result.stats.sum { |stat| stat[:total_count] } total_top_level_count = result.stats.sum { |stat| stat[:top_level_count] } total_time = result.stats.sum { |stat| stat[:top_level_time] } total_uniq_factories = result.stats.map { |stat| stat[:name] }.uniq.count msgs << " Factories usage\n\n Total: \#{total_count}\n Total top-level: \#{total_top_level_count}\n Total time: \#{format(\"%.4f\", total_time)}s\n Total uniq factories: \#{total_uniq_factories}\n\n total top-level total time time per call top-level time name\n MSG\n\n result.stats.each do |stat|\n time_per_call = stat[:total_time] / stat[:total_count]\n\n msgs << format(\"%8d %11d %13.4fs %17.4fs %18.4fs %18s\", stat[:total_count], stat[:top_level_count], stat[:total_time], time_per_call, stat[:top_level_time], stat[:name])\n end\n\n log :info, msgs.join(\"\\n\")\nend\n" |