forked from yob/pdf-reader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.rb
20 lines (16 loc) · 964 Bytes
/
profile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Driver to run a bunch of profiling scripts in parallel,
# leaving all the results in tools/profiles
# Assumes "ruby" is Ruby 1.9, and "ruby1.8" is Ruby 1.8.7
# Also assumes that all needed gems are installed
# This script itself should be run under Ruby 1.9
require 'fileutils'
project_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
dir = "#{project_root}/tools/profiles"
FileUtils.mkdir(dir) unless File.exist?(dir)
pids = []
pids << fork { `ruby-prof #{project_root}/tools/bench.rb 1 --file=#{dir}/rubyprof.txt` }
pids << fork { `ruby-prof #{project_root}/tools/bench.rb 1 --file=#{dir}/rubyprof-graph.htm --printer=graph_html` }
pids << fork { `ruby-prof #{project_root}/tools/bench.rb 1 --file=#{dir}/rubyprof-stack.htm --printer=call_stack` }
pids << fork { `ruby1.8 #{project_root}/tools/bench.rb memprof > #{dir}/memprof.txt` }
pids << fork { `ruby #{project_root}/tools/bench.rb perftools` }
pids.each { |pid| Process.wait(pid) }