Sha256: 0ac060e68b0cb7955d4a82d2f86020f77dbe50b54674e4c7e26b53d72f6c803b

Contents?: true

Size: 789 Bytes

Versions: 12

Compression:

Stored size: 789 Bytes

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)
require_relative './measure_times'

class CallTreeVisitorTest < TestCase
  def test_visit
    result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
      RubyProf::C1.sleep_wait
    end

    visitor = RubyProf::CallTreeVisitor.new(result.threads.first.call_tree)

    method_names = Array.new

    visitor.visit do |call_tree, event|
      method_names << call_tree.target.full_name if event == :enter
    end

    assert_equal(3, method_names.length)
    assert_equal("CallTreeVisitorTest#test_visit", method_names[0])
    assert_equal("<Class::RubyProf::C1>#sleep_wait", method_names[1])
    assert_equal("Kernel#sleep", method_names[2])
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ruby-prof-1.7.1-x64-mingw-ucrt test/call_tree_visitor_test.rb
ruby-prof-1.7.1 test/call_tree_visitor_test.rb
ruby-prof-1.7.0-x64-mingw-ucrt test/call_tree_visitor_test.rb
ruby-prof-1.7.0 test/call_tree_visitor_test.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/test/call_tree_visitor_test.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/test/call_tree_visitor_test.rb
ruby-prof-1.6.3-x64-mingw-ucrt test/call_tree_visitor_test.rb
ruby-prof-1.6.3 test/call_tree_visitor_test.rb
ruby-prof-1.6.2-x64-mingw-ucrt test/call_tree_visitor_test.rb
ruby-prof-1.6.2 test/call_tree_visitor_test.rb
ruby-prof-1.6.1 test/call_tree_visitor_test.rb
ruby-prof-1.6.1-x64-mingw-ucrt test/call_tree_visitor_test.rb