Created
May 17, 2012 21:26
-
-
Save cprice404/2721671 to your computer and use it in GitHub Desktop.
Callgrind profile data for a puppet client run
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
#!/usr/bin/env ruby | |
require 'ruby-prof' | |
RubyProf.measure_mode = RubyProf::PROCESS_TIME | |
#RubyProf.measure_mode = RubyProf::ALLOCATIONS | |
#RubyProf.measure_mode = RubyProf::MEMORY | |
RubyProf.start | |
begin | |
require 'puppet/util/command_line' | |
Puppet::Util::CommandLine.new.execute | |
rescue SystemExit | |
# Grrrrrr.... It makes me sad that I have to do this | |
end | |
result = RubyProf.stop | |
printer = RubyProf::CallTreePrinter.new(result) | |
report_file = File.open("./profile.callgrind", "w") | |
printer.print(report_file) | |
report_file.close | |
~ | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment