module Minitest::Hog

Attributes

memory_used[RW]

Public Class Methods

sample() click to toggle source
# File lib/minitest/hog.rb, line 6
def self.sample
  sampler.call
end
sampler() click to toggle source
# File lib/minitest/hog.rb, line 14
def self.sampler
  @memory_sampler ||= Minitest::ShellPs.new
end
sampler=(sampler) click to toggle source
# File lib/minitest/hog.rb, line 10
def self.sampler= sampler
  @memory_sampler = sampler
end

Public Instance Methods

after_teardown() click to toggle source
Calls superclass method
# File lib/minitest/hog.rb, line 26
def after_teardown
  super
  if memory_used
    self.memory_used = Minitest::Hog.sample - memory_used
  else
    self.memory_used
  end
  
  GC.enable
end
before_setup() click to toggle source
Calls superclass method
# File lib/minitest/hog.rb, line 18
def before_setup
  super
  GC.start
  GC.disable

  self.memory_used = Minitest::Hog.sample
end