Skip to content

Commit

Permalink
status: ping time
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed May 9, 2024
1 parent 4816730 commit 48514da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions framework/status-json.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def get_ndnping():

if ping_prefix:
print(f'ndnping {host_name} with prefix {ping_prefix} -> ', file=sys.stderr, end='', flush=True)

# TODO: This doesn't measure the network time but the execution time
t_start = time.time()
code, _ = compose.exec('ndnpingserver', ['ndnping', '-c', '3', '-i', '10', ping_prefix], timeout=10)
success = code == 0
result[host_name] = success
print('success' if success else 'fail', file=sys.stderr)
duration = (time.time() - t_start) * 1000
result[host_name] = duration if success else None
print(duration if success else 'fail', file=sys.stderr)

return result

Expand Down

0 comments on commit 48514da

Please sign in to comment.