Last active
January 1, 2016 12:19
-
-
Save agrimm/8143429 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$ bundle exec ruby-prof --printer=graph --file=graph_text_reproduction.txt lib/reproduction.rb | |
$ bundle list | |
Gems included by the bundle: | |
* bundler (1.3.5) | |
* ruby-prof (0.13.1 39757df) | |
$ uname -a | |
Darwin [redacted] 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 |
This file contains hidden or 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
Thread ID: 2151930980 | |
Fiber ID: 2156305520 | |
Total Time: 8.778087000000003 | |
Sort by: total_time | |
%total %self total self wait child calls Name | |
-------------------------------------------------------------------------------- | |
100.00% 0.00% 8.778 0.000 0.000 8.778 2 Global#[No method] | |
8.778 0.000 0.000 8.778 1/1 Object#run_the_methods | |
0.000 0.000 0.000 0.000 3/3 Module#method_added | |
0.000 0.000 0.000 0.000 1/1 Class#inherited | |
-------------------------------------------------------------------------------- | |
8.778 0.000 0.000 8.778 1/1 Global#[No method] | |
100.00% 0.00% 8.778 0.000 0.000 8.778 1 Object#run_the_methods | |
8.778 0.000 0.000 8.778 1/1 RubyProfReproduction#throw_rescue_exceptions_method | |
0.000 0.000 0.000 0.000 1/1 Class#new | |
-------------------------------------------------------------------------------- | |
8.778 0.000 0.000 8.778 1/1 Object#run_the_methods | |
100.00% 0.00% 8.778 0.000 0.000 8.778 1 RubyProfReproduction#throw_rescue_exceptions_method | |
8.778 0.000 0.000 8.778 1/1 RubyProfReproduction#slow_method | |
0.000 0.000 0.000 0.000 1/1 Module#const_missing | |
-------------------------------------------------------------------------------- | |
8.778 0.000 0.000 8.778 1/1 RubyProfReproduction#throw_rescue_exceptions_method | |
100.00% 0.00% 8.778 0.000 0.000 8.778 1 RubyProfReproduction#slow_method | |
8.778 5.725 0.000 3.053 1/1 Kernel#loop | |
-------------------------------------------------------------------------------- | |
8.778 5.725 0.000 3.053 1/1 RubyProfReproduction#slow_method | |
100.00% 65.22% 8.778 5.725 0.000 3.053 1 Kernel#loop | |
1.030 1.030 0.000 0.000 1000000/1000000 Fixnum#** | |
1.012 1.012 0.000 0.000 1000001/1000001 Fixnum#> | |
1.011 1.011 0.000 0.000 1000001/1000001 Fixnum#+ | |
-------------------------------------------------------------------------------- | |
1.030 1.030 0.000 0.000 1000000/1000000 Kernel#loop | |
11.73% 11.73% 1.030 1.030 0.000 0.000 1000000 Fixnum#** | |
-------------------------------------------------------------------------------- | |
1.012 1.012 0.000 0.000 1000001/1000001 Kernel#loop | |
11.53% 11.53% 1.012 1.012 0.000 0.000 1000001 Fixnum#> | |
-------------------------------------------------------------------------------- | |
1.011 1.011 0.000 0.000 1000001/1000001 Kernel#loop | |
11.52% 11.52% 1.011 1.011 0.000 0.000 1000001 Fixnum#+ | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 RubyProfReproduction#throw_rescue_exceptions_method | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Module#const_missing | |
0.000 0.000 0.000 0.000 1/1 NameError#initialize | |
0.000 0.000 0.000 0.000 1/1 Exception#backtrace | |
0.000 0.000 0.000 0.000 1/1 Module#=== | |
0.000 0.000 0.000 0.000 1/1 Exception#exception | |
-------------------------------------------------------------------------------- | |
0.00% 0.00% 0.000 0.000 0.000 0.000 2 IO#set_encoding | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Module#const_missing | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 NameError#initialize | |
0.000 0.000 0.000 0.000 1/1 Exception#initialize | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Object#run_the_methods | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Class#new | |
0.000 0.000 0.000 0.000 1/1 BasicObject#initialize | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 NameError#initialize | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Exception#initialize | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 3/3 Global#[No method] | |
0.00% 0.00% 0.000 0.000 0.000 0.000 3 Module#method_added | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Module#const_missing | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Exception#backtrace | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Class#new | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 BasicObject#initialize | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Module#const_missing | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Module#=== | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Global#[No method] | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Class#inherited | |
-------------------------------------------------------------------------------- | |
0.000 0.000 0.000 0.000 1/1 Module#const_missing | |
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Exception#exception | |
* indicates recursively called methods |
This file contains hidden or 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
Note: I couldn't run it using bundle exec, so I had to run it using an unrelated ruby-prof-check-trace file. | |
LINE 2: return event without call: RubyProf::Profile#start | |
STACK: [] | |
fixing stack | |
LINE 3: return event without call: Module#start | |
STACK: [] | |
fixing stack | |
LINE 44: return event without call: RubyProfReproduction#throw_rescue_exceptions_method | |
STACK: ["Kernel#load", "Object#run_the_methods", "RubyProfReproduction#throw_rescue_exceptions_method"] | |
fixing stack | |
LINE 9000060: return event without call: Module#start_script | |
STACK: [] | |
fixing stack | |
LINE 9000061: return event without call: RubyProf::Cmd#run | |
STACK: [] | |
fixing stack | |
LINE 9000062: return event without call: Kernel#load | |
STACK: [] | |
fixing stack | |
{4303861961=>{4312611201=>["Module#stop", "RubyProf::Profile#stop"]}} |
This file contains hidden or 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
class RubyProfReproduction | |
def throw_rescue_exceptions_method | |
NO_SUCH_CONSTANT rescue nil | |
# Just so that throwing an exception was not the last line of a method | |
42 | |
end | |
def slow_method | |
i = 0 | |
loop do | |
i += 1 | |
return if i > 1_000_000 | |
123456789 ** 2 | |
end | |
end | |
end | |
def run_the_methods | |
reproduction = RubyProfReproduction.new | |
reproduction.throw_rescue_exceptions_method | |
reproduction.slow_method | |
end | |
run_the_methods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment