latency logger: better errors and minor cleanup

old-commit-hash: 930d0c01a9
taco
Adeeb Shihadeh 3 years ago
parent 24c9e250f9
commit 0195ae1464
  1. 10
      tools/latencylogger/latency_logger.py

@ -25,7 +25,7 @@ MSGQ_TO_SERVICE = {
SERVICE_TO_DURATIONS = {
'camerad': ['processingTime'],
'modeld': ['modelExecutionTime', 'gpuExecutionTime'],
'plannerd': ["solverExecutionTime"],
'plannerd': ['solverExecutionTime'],
}
def read_logs(lr):
@ -105,8 +105,9 @@ def find_t0(start_times, frame_id=-1):
frame_id += 1
raise Exception('No start time has been set')
## ASSUMES THAT AT LEAST ONE CLOUDLOG IS MADE IN CONTROLSD
def insert_cloudlogs(lr, timestamps, start_times, end_times):
# at least one cloudlog must be made in controlsd
t0 = find_t0(start_times)
failed_inserts = 0
latest_controls_frameid = 0
@ -139,10 +140,11 @@ def insert_cloudlogs(lr, timestamps, start_times, end_times):
timestamps[frame_id][service].append((event, time))
else:
failed_inserts += 1
if latest_controls_frameid == 0:
print("Warning, no timestamp in controlsd. Implementation assumes that a timestamp is made in controlsd to bind boardd logs to frame ID. Please add such a timestamp.")
print("Warning: failed to bind boardd logs to a frame ID. Add a timestamp cloudlog in controlsd.")
elif failed_inserts > len(timestamps):
print("Warning, many cloudlog inserts failed", failed_inserts)
print(f"Warning: failed to bind {failed_inserts} cloudlog timestamps to a frame ID")
def print_timestamps(timestamps, durations, start_times, relative):
t0 = find_t0(start_times)

Loading…
Cancel
Save