Skip to content
Snippets Groups Projects
Commit ed25a33e authored by vjpai's avatar vjpai
Browse files

Improved formatting

parent 5286eee5
No related branches found
No related tags found
No related merge requests found
...@@ -80,17 +80,24 @@ class BenchmarkClient ...@@ -80,17 +80,24 @@ class BenchmarkClient
(0..config.client_channels-1).each do |i| (0..config.client_channels-1).each do |i|
Thread.new { Thread.new {
stub = '' stub = ''
req = Grpc::Testing::SimpleRequest.new(response_type: Grpc::Testing::PayloadType::COMPRESSABLE, gtsr = Grpc::Testing::SimpleRequest
response_size: config.payload_config.simple_params.resp_size, gtpt = Grpc::Testing::PayloadType
payload: Grpc::Testing::Payload.new(type: Grpc::Testing::PayloadType::COMPRESSABLE, gtp = Grpc::Testing::Payload
body: nulls(config.payload_config.simple_params.req_size))) 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 case config.load_params.load.to_s
when 'closed_loop' when 'closed_loop'
waiter = nil waiter = nil
when 'poisson' 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 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 case config.rpc_type
when :UNARY when :UNARY
unary_ping_ponger(req,stub,config,waiter) unary_ping_ponger(req,stub,config,waiter)
......
...@@ -79,7 +79,8 @@ class BenchmarkServer ...@@ -79,7 +79,8 @@ class BenchmarkServer
} }
end end
def mark(reset) 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 @start_time = Time.now if reset
s s
end end
...@@ -87,4 +88,3 @@ class BenchmarkServer ...@@ -87,4 +88,3 @@ class BenchmarkServer
@port @port
end end
end end
...@@ -54,13 +54,14 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service ...@@ -54,13 +54,14 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
q = EnumeratorQueue.new(self) q = EnumeratorQueue.new(self)
Thread.new { Thread.new {
bms = '' bms = ''
gtss = Grpc::Testing::ServerStatus
reqs.each do |req| reqs.each do |req|
case req.argtype.to_s case req.argtype.to_s
when 'setup' when 'setup'
bms = BenchmarkServer.new(req.setup, @server_port) 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' 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
end end
q.push(self) q.push(self)
...@@ -78,7 +79,8 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service ...@@ -78,7 +79,8 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
client = BenchmarkClient.new(req.setup) client = BenchmarkClient.new(req.setup)
q.push(Grpc::Testing::ClientStatus.new(stats: client.mark(false))) q.push(Grpc::Testing::ClientStatus.new(stats: client.mark(false)))
when 'mark' 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
end end
q.push(self) q.push(self)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment