Skip to content

Commit

Permalink
add option --dont-start
Browse files Browse the repository at this point in the history
  • Loading branch information
paddor committed Jan 17, 2024
1 parent f35da89 commit 6a96777
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions bin/ruby-prof
Expand Up @@ -17,6 +17,7 @@ module RubyProf
#
# Options:
# --allow_exceptions Raise exceptions encountered during profiling (true) or suppress them (false)
# --dont-start Don't start profile yet (start manually with RubyProf::Profile.current.start)
# -E, --eval-noprof=code execute the ruby statements (not profiled)
# --exclude=methods A comma separated list of methods to exclude.
# Specify instance methods via # (Integer#times)
Expand Down Expand Up @@ -73,6 +74,7 @@ module RubyProf
options.pre_libs = Array.new
options.pre_execs = Array.new
options.printer = RubyProf::FlatPrinter
options.dont_start = false
options.track_allocations = false
end

Expand Down Expand Up @@ -124,6 +126,10 @@ module RubyProf
options.allow_exceptions = true
end

opts.on('--dont-start', "Don't start profile yet (start manually with RubyProf::Profile.current.start)") do
options.dont_start = true
end

opts.on('-E code', '--eval-noprof=code', 'execute the ruby statements (not profiled)') do |code|
options.pre_execs << code
end
Expand Down Expand Up @@ -299,8 +305,13 @@ module RubyProf
end

script = ARGV.shift
profile.profile do
load script

if options.dont_start
load script
else
profile.profile do
load script
end
end
end
end
Expand Down

0 comments on commit 6a96777

Please sign in to comment.