Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed time and size units (should be seconds / bytes), fixed typo whe…

…n counting memory allocations under rubinius
  • Loading branch information...
commit 278344b3fab67fcc471f475992a86c3748a83e23 1 parent 417b2ba
@goncalossilva goncalossilva authored
View
13 activesupport/lib/active_support/testing/performance/rubinius.rb
@@ -9,19 +9,18 @@ def run_gc
end
module Metrics
- class Base
+ class Base
+ attr_reader :loopback
+
# TODO
def profile
yield
end
-
- def loopback
- @loopback ||= Rubinius::Agent.loopback
- end
protected
# overridden by each implementation
def with_gc_stats
+ @loopback = Rubinius::Agent.loopback
GC.run(true)
yield
end
@@ -53,7 +52,7 @@ def measure
class Objects < Amount
def measure
- loopback.get("system.memory.counter.bytes").last
+ loopback.get("system.memory.counter.objects").last
end
end
@@ -65,7 +64,7 @@ def measure
class GcTime < Time
def measure
- loopback.get("system.gc.full.wallclock").last + loopback.get("system.gc.young.wallclock").last
+ (loopback.get("system.gc.full.wallclock").last + loopback.get("system.gc.young.wallclock").last) / 1000.0
end
end
end
View
2  activesupport/lib/active_support/testing/performance/ruby.rb
@@ -1,7 +1,7 @@
begin
require 'ruby-prof'
rescue LoadError
- $stderr.puts "Specify ruby-prof as application's dependency in Gemfile to run benchmarks."
+ $stderr.puts 'Specify ruby-prof as application\'s dependency in Gemfile to run benchmarks.'
exit
end
View
4 activesupport/lib/active_support/testing/performance/ruby/mri.rb
@@ -19,7 +19,7 @@ class Memory < Base
# Ruby 1.8 + ruby-prof wrapper
if RubyProf.respond_to?(:measure_memory)
def measure
- RubyProf.measure_memory / 1024.0
+ RubyProf.measure_memory
end
end
end
@@ -48,7 +48,7 @@ class GcTime < Time
# Ruby 1.8 + ruby-prof wrapper
if RubyProf.respond_to?(:measure_gc_time)
def measure
- RubyProf.measure_gc_time / 1000
+ RubyProf.measure_gc_time / 1000.0 / 1000.0
end
end
end
View
2  activesupport/lib/active_support/testing/performance/ruby/yarv.rb
@@ -20,7 +20,7 @@ class Memory < Base
# Ruby 1.9 + GCdata patch
if GC.respond_to?(:malloc_allocated_size)
def measure
- GC.malloc_allocated_size / 1024.0
+ GC.malloc_allocated_size
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.