aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/benchmark.rb
blob: 641b58c8b8c417826ea2eb0d624bb19a17d1cab2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
                             
 
                   
 
                  






                                       

                             
     
   
# frozen_string_literal: true

require "benchmark"

class << Benchmark
  # Benchmark realtime in milliseconds.
  #
  #   Benchmark.realtime { User.all }
  #   # => 8.0e-05
  #
  #   Benchmark.ms { User.all }
  #   # => 0.074
  def ms
    1000 * realtime { yield }
  end
end