bench/runner.rb in sanford-0.7.0 vs bench/runner.rb in sanford-0.8.0
- old
+ new
@@ -8,11 +8,11 @@
class Runner
# this should match up with bench/services host and port
HOST_AND_PORT = [ '127.0.0.1', 59284 ]
REQUESTS = [
- [ 'v1', 'simple', {}, 10000 ]
+ [ 'simple', {}, 10000 ]
]
TIME_MODIFIER = 10 ** 4 # 4 decimal places
def initialize(options = {})
@@ -22,23 +22,23 @@
end
def build_report
output "Running benchmark report..."
- REQUESTS.each do |version, name, params, times|
- self.benchmark_service(version, name, params, times, false)
+ REQUESTS.each do |name, params, times|
+ self.benchmark_service(name, params, times, false)
end
output "Done running benchmark report"
end
- def benchmark_service(version, name, params, times, show_result = false)
+ def benchmark_service(name, params, times, show_result = false)
benchmarks = []
output "\nHitting #{name.inspect} service with #{params.inspect}, #{times} times"
[*(1..times.to_i)].each do |index|
- benchmark = self.hit_service(version, name, params.merge({ :request_number => index }), show_result)
+ benchmark = self.hit_service(name, params.merge({ :request_number => index }), show_result)
benchmarks << self.round_time(benchmark.real * 1000.to_f)
output('.', false) if ((index - 1) % 100 == 0) && !show_result
end
output("\n", false)
@@ -71,14 +71,14 @@
output "\n"
end
- def hit_service(version, name, params, show_result)
+ def hit_service(name, params, show_result)
Benchmark.measure do
begin
client = Bench::Client.new(*HOST_AND_PORT)
- response = client.call(version, name, params)
+ response = client.call(name, params)
if show_result
output "Got a response:"
output " #{response.status}"
output " #{response.data.inspect}"
end