Improved formatting

pull/6010/head
vjpai 9 years ago
parent 5286eee5a9
commit ed25a33eb2
  1. 19
      src/ruby/qps/client.rb
  2. 4
      src/ruby/qps/server.rb
  3. 8
      src/ruby/qps/worker.rb

@ -80,17 +80,24 @@ class BenchmarkClient
(0..config.client_channels-1).each do |i|
Thread.new {
stub = ''
req = Grpc::Testing::SimpleRequest.new(response_type: Grpc::Testing::PayloadType::COMPRESSABLE,
response_size: config.payload_config.simple_params.resp_size,
payload: Grpc::Testing::Payload.new(type: Grpc::Testing::PayloadType::COMPRESSABLE,
body: nulls(config.payload_config.simple_params.req_size)))
gtsr = Grpc::Testing::SimpleRequest
gtpt = Grpc::Testing::PayloadType
gtp = Grpc::Testing::Payload
simple_params = config.payload_config.simple_params
req = gtsr.new(response_type: gtpt::COMPRESSABLE,
response_size: simple_params.resp_size,
payload: gtp.new(type: gtpt::COMPRESSABLE,
body: nulls(simple_params.req_size)))
case config.load_params.load.to_s
when 'closed_loop'
waiter = nil
when 'poisson'
waiter = Poisson.new(config.load_params.poisson.offered_load / config.client_channels)
waiter = Poisson.new(config.load_params.poisson.offered_load /
config.client_channels)
end
stub = Grpc::Testing::BenchmarkService::Stub.new(config.server_targets[i % config.server_targets.length], cred)
gtbss = Grpc::Testing::BenchmarkService::Stub
st = config.server_targets
stub = gtbss.new(st[i % st.length], cred)
case config.rpc_type
when :UNARY
unary_ping_ponger(req,stub,config,waiter)

@ -79,7 +79,8 @@ class BenchmarkServer
}
end
def mark(reset)
s = Grpc::Testing::ServerStats.new(time_elapsed: (Time.now-@start_time).to_f)
s = Grpc::Testing::ServerStats.new(time_elapsed:
(Time.now-@start_time).to_f)
@start_time = Time.now if reset
s
end
@ -87,4 +88,3 @@ class BenchmarkServer
@port
end
end

@ -54,13 +54,14 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
q = EnumeratorQueue.new(self)
Thread.new {
bms = ''
gtss = Grpc::Testing::ServerStatus
reqs.each do |req|
case req.argtype.to_s
when 'setup'
bms = BenchmarkServer.new(req.setup, @server_port)
q.push(Grpc::Testing::ServerStatus.new(stats: bms.mark(false), port: bms.get_port))
q.push(gtss.new(stats: bms.mark(false), port: bms.get_port))
when 'mark'
q.push(Grpc::Testing::ServerStatus.new(stats: bms.mark(req.mark.reset), cores: cpu_cores))
q.push(gtss.new(stats: bms.mark(req.mark.reset), cores: cpu_cores))
end
end
q.push(self)
@ -78,7 +79,8 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
client = BenchmarkClient.new(req.setup)
q.push(Grpc::Testing::ClientStatus.new(stats: client.mark(false)))
when 'mark'
q.push(Grpc::Testing::ClientStatus.new(stats: client.mark(req.mark.reset)))
q.push(Grpc::Testing::ClientStatus.new(stats:
client.mark(req.mark.reset)))
end
end
q.push(self)

Loading…
Cancel
Save