json bug fix

latency_logging
Lukas Petersson 2022-03-25 14:59:00 -07:00
parent eb4dd2cb6e
commit 1fee24c612
4 changed files with 11 additions and 9 deletions

View File

@ -94,7 +94,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
//TODO: SET CONTEXT
//setenv("FRAME_ID", std::to_string(meta_main.frame_id).c_str(), 1);
set_frame_id(meta_main.frame_id);
LOGT("vicp read main")
LOGT("vicp read main");
if (use_extra_client) {
// Keep receiving extra frames until frame id matches main camera
do {
@ -105,7 +105,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
LOGE("vipc_client_extra no frame");
continue;
}
LOGT("vicp read extra")
LOGT("vicp read extra");
if (std::abs((int64_t)meta_main.timestamp_sof - (int64_t)meta_extra.timestamp_sof) > 10000000ULL) {
LOGE("frames out of sync! main: %d (%.5f), extra: %d (%.5f)",

View File

@ -8,7 +8,6 @@ from tabulate import tabulate
json_file = open('timestamps.json')
timestamps = json.load(json_file)
for frame_id, services in timestamps.items():
t0 = min([min([min(times) for times in events.values()]) for events in services.values()])
print(frame_id)

View File

@ -28,7 +28,7 @@ for msg in lr:
translationdict[logMonoTime] = frame_id
print(translationdict)
i = 0
for msg in lr:
if msg.which() == "logMessage" and "timestamp" in msg.logMessage:
msg = msg.logMessage.replace("'", '"').replace('"{', "{").replace('}"', "}")
@ -38,11 +38,14 @@ for msg in lr:
time = jmsg['msg']['timestamp']['time']
frame_id = jmsg['ctx']['frame_id']
if jmsg['msg']['timestamp']['translate']:
frame_id = translationdict[int(frame_id)]
timestamps[frame_id][service][event].append(time)
try:
frame_id = translationdict[int(frame_id)]
except:
i+=1
continue
timestamps[int(frame_id)][service][event].append(time)
print(timestamps[1].keys())
print("Num failed translations:", i)
with open('timestamps.json', 'w') as outfile:
json.dump(timestamps, outfile)

File diff suppressed because one or more lines are too long