add recvplotdiff

This commit is contained in:
flandre 2025-05-13 22:04:30 +08:00
parent 680ea99b6b
commit d018e1cf1a

View File

@ -236,9 +236,32 @@ def device_recvplot():
print((ts - last_ts) / 10 ** 6, flush=True)
last_ts = ts
@device.command('recvplotdiff')
def device_recvplotdiff():
ctx = zmq.Context()
pull = ctx.socket(zmq.PULL)
pull.connect(C.live_push_socket)
last_ts = 0
max_interval = 0
first = True
while True:
b = pull.recv()
ts, sequence_id, encoder, buffer = b2t(b)
if first:
last_ts = ts
first = False
continue
max_interval = max(max_interval, ts - last_ts)
print(max_interval / 10 ** 6, flush=True)
last_ts = ts
def b2b(b):
return hashlib.blake2b(b, digest_size=4).hexdigest()
@device.command('recvzero')
def device_recvzero():
ctx = zmq.Context()