francois / redis-rb forked from ezmobius/redis-rb

A ruby client library for the redis key value storage engine

francois (author)
Thu Jun 25 08:49:17 -0700 2009
commit  e0e4bb9bdc0a341ea25874284fa11bb013f1cc7f
tree    d02bf6f2b427490db1a56643a89a97f3baecedc7
parent  e039bb823573c4a8b9a04047a75ac1431ee813f6
redis-rb / profile.rb
100644 23 lines (17 sloc) 0.429 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'rubygems'
require 'ruby-prof'
require "#{File.dirname(__FILE__)}/lib/redis"
 
 
mode = ARGV.shift || 'process_time'
n = (ARGV.shift || 200).to_i
 
r = Redis.new
RubyProf.measure_mode = RubyProf.const_get(mode.upcase)
RubyProf.start
 
n.times do |i|
  key = "foo#{i}"
  r[key] = key * 10
  r[key]
end
 
results = RubyProf.stop
File.open("profile.#{mode}", 'w') do |out|
  RubyProf::CallTreePrinter.new(results).print(out)
end