]>
Commit | Line | Data |
---|---|---|
29fac617 | 1 | require 'rubygems' |
2 | require 'ruby-prof' | |
3 | require "#{File.dirname(__FILE__)}/lib/redis" | |
4 | ||
5 | ||
6 | mode = ARGV.shift || 'process_time' | |
7 | n = (ARGV.shift || 200).to_i | |
8 | ||
9 | r = Redis.new | |
10 | RubyProf.measure_mode = RubyProf.const_get(mode.upcase) | |
11 | RubyProf.start | |
12 | ||
13 | n.times do |i| | |
14 | key = "foo#{i}" | |
15 | r[key] = key * 10 | |
16 | r[key] | |
17 | end | |
18 | ||
19 | results = RubyProf.stop | |
20 | File.open("profile.#{mode}", 'w') do |out| | |
21 | RubyProf::CallTreePrinter.new(results).print(out) | |
22 | end |