aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/performance/mri.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/testing/performance/mri.rb')
-rw-r--r--activesupport/lib/active_support/testing/performance/mri.rb36
1 files changed, 7 insertions, 29 deletions
diff --git a/activesupport/lib/active_support/testing/performance/mri.rb b/activesupport/lib/active_support/testing/performance/mri.rb
index cfa48890dc..914e546090 100644
--- a/activesupport/lib/active_support/testing/performance/mri.rb
+++ b/activesupport/lib/active_support/testing/performance/mri.rb
@@ -8,17 +8,12 @@ end
module ActiveSupport
module Testing
module Performance
+
protected
- def run_warmup
- GC.start
-
- time = Metrics::Time.new
- run_test(time, :benchmark)
- puts "%s (%s warmup)" % [full_test_name, time.format(time.total)]
-
+ def run_gc
GC.start
end
-
+
class Performer; end
class Profiler < Performer
@@ -81,6 +76,10 @@ module ActiveSupport
module Metrics
class Base
+ def measure_mode
+ self.class::Mode
+ end
+
def profile
RubyProf.resume
yield
@@ -107,11 +106,6 @@ module ActiveSupport
ensure
GC.disable_stats
end
-
- else
- def with_gc_stats
- yield
- end
end
end
@@ -162,10 +156,6 @@ module ActiveSupport
RubyProf.measure_memory / 1024.0
end
end
-
- def format(measurement)
- '%.2f KB' % measurement
- end
end
class Objects < Base
@@ -183,10 +173,6 @@ module ActiveSupport
RubyProf.measure_allocations
end
end
-
- def format(measurement)
- measurement.to_i.to_s
- end
end
class GcRuns < Base
@@ -204,10 +190,6 @@ module ActiveSupport
RubyProf.measure_gc_runs
end
end
-
- def format(measurement)
- measurement.to_i.to_s
- end
end
class GcTime < Base
@@ -225,10 +207,6 @@ module ActiveSupport
RubyProf.measure_gc_time / 1000
end
end
-
- def format(measurement)
- '%.2f ms' % measurement
- end
end
end
end