Class: Roma::Client::Microbench
- Inherits:
-
Object
- Object
- Roma::Client::Microbench
- Defined in:
- lib/roma/tools/simple_bench2.rb
Instance Attribute Summary collapse
-
#cnt ⇒ Object
readonly
Returns the value of attribute cnt.
-
#runnable ⇒ Object
readonly
Returns the value of attribute runnable.
-
#sleep_time_watcher ⇒ Object
readonly
Returns the value of attribute sleep_time_watcher.
-
#tmax ⇒ Object
readonly
Returns the value of attribute tmax.
-
#tmin ⇒ Object
readonly
Returns the value of attribute tmin.
-
#watcher ⇒ Object
readonly
Returns the value of attribute watcher.
Instance Method Summary collapse
-
#initialize ⇒ Microbench
constructor
A new instance of Microbench.
- #send_random_requests_loop(addr, port) ⇒ Object
- #send_read_requests(addr, port, count) ⇒ Object
Constructor Details
#initialize ⇒ Microbench
Returns a new instance of Microbench.
15 16 17 18 19 20 21 22 |
# File 'lib/roma/tools/simple_bench2.rb', line 15 def initialize @cnt = 0 @tmax = 0 @tmin = 100 @runnable = true @sleep_time_watcher = 10 init_watcher end |
Instance Attribute Details
#cnt ⇒ Object (readonly)
Returns the value of attribute cnt.
8 9 10 |
# File 'lib/roma/tools/simple_bench2.rb', line 8 def cnt @cnt end |
#runnable ⇒ Object (readonly)
Returns the value of attribute runnable.
11 12 13 |
# File 'lib/roma/tools/simple_bench2.rb', line 11 def runnable @runnable end |
#sleep_time_watcher ⇒ Object (readonly)
Returns the value of attribute sleep_time_watcher.
12 13 14 |
# File 'lib/roma/tools/simple_bench2.rb', line 12 def sleep_time_watcher @sleep_time_watcher end |
#tmax ⇒ Object (readonly)
Returns the value of attribute tmax.
9 10 11 |
# File 'lib/roma/tools/simple_bench2.rb', line 9 def tmax @tmax end |
#tmin ⇒ Object (readonly)
Returns the value of attribute tmin.
10 11 12 |
# File 'lib/roma/tools/simple_bench2.rb', line 10 def tmin @tmin end |
#watcher ⇒ Object (readonly)
Returns the value of attribute watcher.
13 14 15 |
# File 'lib/roma/tools/simple_bench2.rb', line 13 def watcher @watcher end |
Instance Method Details
#send_random_requests_loop(addr, port) ⇒ Object
37 38 |
# File 'lib/roma/tools/simple_bench2.rb', line 37 def send_random_requests_loop addr, port end |
#send_read_requests(addr, port, count) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/roma/tools/simple_bench2.rb', line 40 def send_read_requests addr, port, count rc = Roma::Client::RomaClient.new("#{addr}:#{port.to_s}") count.times { |c| i = rand count ts = DateTime.now res = rc.get(i.to_s) puts "get k=#{i} #{res}" if res == :error } end |