Skip to content

Instantly share code, notes, and snippets.

@agrimm
Last active January 1, 2016 12:39
Show Gist options
  • Save agrimm/8146288 to your computer and use it in GitHub Desktop.
Save agrimm/8146288 to your computer and use it in GitHub Desktop.
New version of Ruby code, with command preceding raising an exception, and ruby-prof-check-trace for the new version.
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 53: return event without call: RubyProfReproduction#throw_rescue_exceptions_method
STACK: ["Kernel#load", "Object#run_the_methods", "RubyProfReproduction#throw_rescue_exceptions_method"]
fixing stack
LINE 9000069: return event without call: Module#start_script
STACK: []
fixing stack
LINE 9000070: return event without call: RubyProf::Cmd#run
STACK: []
fixing stack
LINE 9000071: return event without call: Kernel#load
STACK: []
fixing stack
{4303861961=>{4312611201=>["Module#stop", "RubyProf::Profile#stop"]}}
This one uses
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin10.8.0]
and like previous ruby-prof-check-trace is being called on 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 53: return event without call: RubyProfReproduction#throw_rescue_exceptions_method
STACK: ["Kernel#load", "Object#run_the_methods", "RubyProfReproduction#throw_rescue_exceptions_method"]
fixing stack
LINE 9000069: return event without call: Module#start_script
STACK: []
fixing stack
LINE 9000070: return event without call: RubyProf::Cmd#run
STACK: []
fixing stack
LINE 9000071: return event without call: Kernel#load
STACK: []
fixing stack
{4304244361=>{4308813321=>["Module#stop", "RubyProf::Profile#stop"]}}
class RubyProfReproduction
def throw_rescue_exceptions_method
do_very_little
NO_SUCH_CONSTANT rescue nil
# Just so that throwing an exception was not the last line of a method
42
end
def do_very_little
987654321 ** 3
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