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:
Gonçalo Silva
2011-04-03 03:16:35 +01:00
parent 65022acda0
commit 8d558cb1b0
3 changed files with 14 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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