]>
git.saurik.com Git - redis.git/blob - client-libraries/ruby/benchmarking/worker.rb
1 BENCHMARK_ROOT
= File
.dirname(__FILE__
)
2 REDIS_ROOT
= File
.join(BENCHMARK_ROOT
, "..", "lib")
10 Usage: worker.rb [read:write] <start_index> <end_index> <sleep_msec>
23 operation
= shift_from_argv
.to_sym
24 start_index
= shift_from_argv
.to_i
25 end_index
= shift_from_argv
.to_i
26 sleep_msec
= shift_from_argv
.to_i
27 sleep_duration
= sleep_msec
/1000.0
34 start_index
.upto(end_index
) do |i
|
40 start_index
.upto(end_index
) do |i
|
46 puts
"Starting to #{operation} at segment #{end_index + 1}"
50 start_index
.upto(end_index
) do |i
|
57 raise "Unknown operation: #{operation}"
63 requests_processed
= end_index
- start_index
65 puts
"#{t2.strftime("%H:%M")} [segment #{end_index + 1}] : Processed #{requests_processed} requests in #{time} seconds - #{(requests_processed/time).round} requests/sec"
69 raise "Unknown operation: #{operation}"