Sha256: e7db301e3a824fee4c7de94b70b1ddb51a7657e36a01cd1379e61a4e74eb2103

Contents?: true

Size: 749 Bytes

Versions: 91

Compression:

Stored size: 749 Bytes

Contents

require 'benchmark'

module ActionView
  module Helpers
    module BenchmarkHelper
      # Measures the execution time of a block in a template and reports the result to the log. Example:
      #
      #  <% benchmark "Notes section" do %>
      #    <%= expensive_notes_operation %>
      #  <% end %>
      #
      # Will add something like "Notes section (0.34523)" to the log.
      #
      # You may give an optional logger level as the second argument
      # (:debug, :info, :warn, :error).  The default is :info.
      def benchmark(message = "Benchmarking", level = :info)
        if @logger
          real = Benchmark.realtime { yield }
          @logger.send level, "#{message} (#{'%.5f' % real})"
        end
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 5 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb
actionpack-1.10.1 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.11.1 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.10.2 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.1 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.11.0 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.11.2 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.0 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.5 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.4 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.13.0 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.2 lib/action_view/helpers/benchmark_helper.rb
actionpack-1.12.3 lib/action_view/helpers/benchmark_helper.rb