Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ run your script with the debug flag on:

$ jruby --debug my_script.rb


Or you can use its gem script:

$ jruby --debug -S jruby-prof scriptname.rb

Which will profile the entire script, create a local directory named "profile" and output one copy of each graph type there.

LICENSE
-------

Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ require "rake/gempackagetask"
require "rake/rdoctask"

spec = Gem::Specification.new do |s|
s.name = "jruby-prof"
s.version = "0.1.0"
s.name = "rdp-jruby-prof"
s.version = "0.1.0.1"
s.summary = "A Ruby level profiler for JRuby"
s.author = "Daniel Lucraft"
s.email = "dan@fluentradical.com"
Expand All @@ -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
23 changes: 23 additions & 0 deletions bin/jruby-prof
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'rubygems'
require 'jruby-prof'
original_dir = Dir.pwd

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

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

Dir.chdir(original_dir) do
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")
end