Skip to content

Commit

Permalink
add weak jruby-prof executable
Browse files Browse the repository at this point in the history
  • Loading branch information
rdp committed Jul 26, 2010
1 parent dfb1379 commit 961fb1b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Rakefile
Expand Up @@ -15,8 +15,10 @@ spec = Gem::Specification.new do |s|
Dir.glob("{templates/**/*}") +
Dir.glob("{examples/**/*}") +
Dir.glob("{src}/**/*") +
Dir.glob("{test}/**/*")
Dir.glob("{test}/**/*") +
Dir.glob("{bin}/*")
s.require_paths = ["lib"]
s.executables = ["jruby-prof"]
end

Rake::GemPackageTask.new(spec) do |pkg|
Expand Down
20 changes: 20 additions & 0 deletions bin/jruby-prof
@@ -0,0 +1,20 @@
require 'rubygems'
require 'jruby-prof'

if ARGV.detect{|arg| arg == '-h' || arg == '--help'}
puts 'syntax: script_name arg1 arg2 arg3 (writes several outputs to profile/*)'
exit 1
end

ruby_script = ARGV.shift
result = JRubyProf.profile {
require ruby_script
}

require 'fileutils'
FileUtils.mkdir_p "profile"
JRubyProf.print_flat_text(result, "profile/flat.txt")
JRubyProf.print_graph_text(result, "profile/graph.txt")
JRubyProf.print_graph_html(result, "profile/graph.html")
JRubyProf.print_call_tree(result, "profile/call_tree.txt")
JRubyProf.print_tree_html(result, "profile/call_tree.html")

0 comments on commit 961fb1b

Please sign in to comment.