Module: Benchmark::Sweet::Queries
- Included in:
- Job
- Defined in:
- lib/benchmark/sweet/queries.rb
Defined Under Namespace
Classes: QueryCounter
Instance Method Summary collapse
Instance Method Details
#run_queries ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/benchmark/sweet/queries.rb', line 4 def run_queries items.each do |entry| values = ::Benchmark::Sweet::Queries::QueryCounter.count(&entry.block) # { entry.call_times(1) } add_entry entry.label, "rows", values[:instance_count] add_entry entry.label, "queries", values[:sql_count] add_entry entry.label, "ignored", values[:ignored_count] add_entry entry.label, "cached", values[:cache_count] unless [:quiet] printf "%20s: %3d queries %5d ar_objects", entry.label, values[:sql_count], values[:instance_count] printf " (%d ignored)", values[:ignored_count] if values[:ignored_count] > 0 puts end end end |