Permalink
Browse files

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)
  • Loading branch information...
goncalossilva committed Apr 3, 2011
1 parent 65022ac commit 8d558cb1b069410c8f693295c9c4e2ffc9661e06
@@ -126,6 +126,12 @@ def report
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 @@ def initialize(*args)
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 @@ def run
@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

0 comments on commit 8d558cb

Please sign in to comment.