mirror of
https://github.com/fluencelabs/redis
synced 2025-06-18 19:51:22 +00:00
Ruby client library updated. Important changes in this new version!
This commit is contained in:
22
client-libraries/ruby/profile.rb
Normal file
22
client-libraries/ruby/profile.rb
Normal file
@ -0,0 +1,22 @@
|
||||
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
|
Reference in New Issue
Block a user