Ejemplo n.º 1
0
 def time_burst(self):
     msg = common_pb2.TimeMsg()
     msg.time_ns_src = time_ns()
     for res in self.stub.TimeBurst(msg):
         print('___')
         print(res)
         end = time_ns()
         print('oneway: {:.6f} ms \nRTT   : {:.6f} ms'.format(
             (res.time_ns_dst - res.time_ns_src) * 1e-6,
             (end - res.time_ns_src) * 1e-6))
Ejemplo n.º 2
0
 def TimeStream(self, request_iterator, context):
     yield from map(add_time_to_pb,
                    map(lambda _: common_pb2.TimeMsg(), request_iterator()))
Ejemplo n.º 3
0
 def TimeBurst(self, request: common_pb2.TimeMsg, context):
     for i in range(3):
         yield common_pb2.TimeMsg(time_ns_src=request.time_ns_src,
                                  time_ns_dst=time_ns())
Ejemplo n.º 4
0
 def Timeit(self, request: common_pb2.Empty, context) -> common_pb2.TimeMsg:
     # time.sleep(0.01)
     return common_pb2.TimeMsg(time_ns=time_ns())
Ejemplo n.º 5
0
 def genny():
     for i in range(count):
         yield common_pb2.TimeMsg(time_ns_src=time_ns(), )