Last active
December 13, 2015 16:28
-
-
Save harmon/4940289 to your computer and use it in GitHub Desktop.
RubyProf test method to demonstrate odd CallInfo behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/call_info_test.rb b/test/call_info_test.rb | |
index 5914da4..f9839e1 100644 | |
--- a/test/call_info_test.rb | |
+++ b/test/call_info_test.rb | |
@@ -22,9 +22,37 @@ class CallInfoTest < Test::Unit::TestCase | |
# assert_equal(call_info.total_time, call_info_clone.total_time) | |
# end | |
+ class AceOfSpades | |
+ def initialize | |
+ a | |
+ end | |
+ | |
+ def a | |
+ end | |
+ end | |
+ | |
+ | |
+ class QueenOfDiamonds | |
+ def initialize | |
+ a | |
+ end | |
+ | |
+ def a | |
+ end | |
+ end | |
+ | |
+ def test_call_info_printer | |
+ result1 = RubyProf.profile do | |
+ AceOfSpades.new | |
+ QueenOfDiamonds.new | |
+ end | |
+ puts RubyProf::CallInfoPrinter.new(result1).print | |
+ end | |
+ | |
def test_merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby test/call_info_test.rb | |
Run options: --seed 48466 | |
# Running tests: | |
Thread ID: 2151955260 | |
Total Time: 5.793571472167969e-05 | |
Sort by: total_time | |
CallInfoTest#test_call_info_printer (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
Class#new (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
<Class::BasicObject>#allocate (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
CallInfoTest::AceOfSpades#initialize (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
CallInfoTest::AceOfSpades#a (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
CallInfoTest::QueenOfDiamonds#initialize (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
CallInfoTest::QueenOfDiamonds#a (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
#<RubyProf::Thread:0x000001009a4ad8> | |
.. | |
Finished tests in 0.213076s, 9.3863 tests/s, 150.1812 assertions/s. | |
2 tests, 32 assertions, 0 failures, 0 errors, 0 skips |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CallInfoTest#test_call_info_printer (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
Class#new (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
<Class::BasicObject>#allocate (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
CallInfoTest::AceOfSpades#initialize (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
CallInfoTest::AceOfSpades#a (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
Class#new (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
<Class::BasicObject>#allocate (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:2, rec:false) | |
CallInfoTest::QueenOfDiamonds#initialize (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
CallInfoTest::QueenOfDiamonds#a (tt:0.00, st:0.00, wt:0.00, ct:0.00, call:1, rec:false) | |
#<RubyProf::Thread:0x000001009a4ad8> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment