From ae2a6537b7eb13a03820bc449e3448e97f0bd38b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 24 Aug 2023 21:11:01 -0700 Subject: [PATCH] fingerprinting: log FW query time (#27880) * Update car_helpers.py * put in carParams * bumpcereal * rename * bump cereal * add cached * bump cereal * just add to fingerprinted event --- selfdrive/car/car_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 81a8c7eacd..7017580368 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -1,4 +1,5 @@ import os +import time from typing import Callable, Dict, List, Optional, Tuple from cereal import car @@ -125,6 +126,7 @@ def fingerprint(logcan, sendcan, num_pandas): ecu_rx_addrs = set() params = Params() + start_time = time.monotonic() if not skip_fw_query: # Vin query only reliably works through OBDII bus = 1 @@ -165,6 +167,8 @@ def fingerprint(logcan, sendcan, num_pandas): set_obd_multiplexing(params, False) params.put_bool("FirmwareQueryDone", True) + fw_query_time = time.monotonic() - start_time + # CAN fingerprint # drain CAN socket so we get the latest messages messaging.drain_sock_raw(logcan) @@ -185,7 +189,7 @@ def fingerprint(logcan, sendcan, num_pandas): cloudlog.event("fingerprinted", car_fingerprint=car_fingerprint, source=source, fuzzy=not exact_match, cached=cached, fw_count=len(car_fw), ecu_responses=list(ecu_rx_addrs), vin_rx_addr=vin_rx_addr, fingerprints=finger, - error=True) + fw_query_time=fw_query_time, error=True) return car_fingerprint, finger, vin, car_fw, source, exact_match