Class: Roma::Client::Microbench

Inherits:
Object
  • Object
show all
Defined in:
lib/roma/tools/simple_bench2.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMicrobench

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

#cntObject (readonly)

Returns the value of attribute cnt.



8
9
10
# File 'lib/roma/tools/simple_bench2.rb', line 8

def cnt
  @cnt
end

#runnableObject (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_watcherObject (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

#tmaxObject (readonly)

Returns the value of attribute tmax.



9
10
11
# File 'lib/roma/tools/simple_bench2.rb', line 9

def tmax
  @tmax
end

#tminObject (readonly)

Returns the value of attribute tmin.



10
11
12
# File 'lib/roma/tools/simple_bench2.rb', line 10

def tmin
  @tmin
end

#watcherObject (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