class MethodEliminationTest

  1. test/method_elimination_test.rb

Public Instance methods

setup ()
[show source]
# File test/method_elimination_test.rb, line 29
def setup
  # Need to use wall time for this test due to the sleep calls
  RubyProf::measure_mode = RubyProf::WALL_TIME
end
test_methods_can_be_eliminated ()
[show source]
# File test/method_elimination_test.rb, line 45
def test_methods_can_be_eliminated
  RubyProf.start
  5.times{ESTPT.new.a}
  result = RubyProf.stop
  # result.dump
  eliminated = result.eliminate_methods!([%rInteger#times/])
  # puts eliminated.inspect
  # result.dump
  eliminated.each do |m|
    assert_method_has_been_eliminated(result, m)
  end
end
test_setting_parent ()
[show source]
# File test/method_elimination_test.rb, line 34
def test_setting_parent
  result = RubyProf.profile do
    1000.times { 1+1 }
  end
  method_infos = result.threads.values.first
  assert(m1 = method_infos[0])
  assert(c1 = m1.call_infos.first)
  assert_equal(c1, c1.parent = c1)
  assert_equal c1, c1.parent
end