python获取毫秒级别时间差以评估rpc call time cost

  • Post author:
  • Post category:python


import zerorpc
import time


t1 = time.time()
t1_ms = int(round(t1*1000))
print(t1_ms)
c1 = zerorpc.Client()
c1.connect("tcp://127.0.0.1:4242")
print(c1.lla_to_ecef(39.980576, 116.5038403, 0.000000))
t2 = time.time()
t2_ms = int(round(t2*1000))
print(t2_ms)
print (t2_ms-t1_ms)

result like below

1660267823330
[-2184027.441145869, 4379746.191972, 4076333.183852116]
1660267823358
//rpc call function execution
1660267966259
[-2184027.441145869, 4379746.191972, 4076333.183852116]
1660267966281
22



版权声明:本文为youcharming原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。