mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
don't use internal profiler methods on Rubinius and JRuby since we're only measuring wall clock for now (and the APIs will/can change, respectively)
This commit is contained in:
@@ -126,6 +126,12 @@ module ActiveSupport
|
||||
end
|
||||
end
|
||||
|
||||
def time_with_block
|
||||
before = Time.now
|
||||
yield
|
||||
Time.now - before
|
||||
end
|
||||
|
||||
def run; end
|
||||
def record; end
|
||||
end
|
||||
|
||||
@@ -27,11 +27,11 @@ module ActiveSupport
|
||||
def run
|
||||
return unless @supported
|
||||
|
||||
@data = JRuby::Profiler.profile do
|
||||
full_profile_options[:runs].to_i.times { run_test(@metric, :profile) }
|
||||
@total = time_with_block do
|
||||
@data = JRuby::Profiler.profile do
|
||||
full_profile_options[:runs].to_i.times { run_test(@metric, :profile) }
|
||||
end
|
||||
end
|
||||
|
||||
@total = @data.getDuration / 1000 / 1000 / 1000.0 # seconds
|
||||
end
|
||||
|
||||
def record
|
||||
|
||||
@@ -29,11 +29,11 @@ module ActiveSupport
|
||||
|
||||
@profiler = Rubinius::Profiler::Instrumenter.new
|
||||
|
||||
@profiler.profile(false) do
|
||||
full_profile_options[:runs].to_i.times { run_test(@metric, :profile) }
|
||||
@total = time_with_block do
|
||||
@profiler.profile(false) do
|
||||
full_profile_options[:runs].to_i.times { run_test(@metric, :profile) }
|
||||
end
|
||||
end
|
||||
|
||||
@total = @profiler.info[:runtime] / 1000 / 1000 / 1000.0 # seconds
|
||||
end
|
||||
|
||||
def record
|
||||
|
||||
Reference in New Issue
Block a user