Log prepare, upload, and total OTA timing separately

This commit is contained in:
J. Nick Koston
2026-08-21 00:13:44 -05:00
parent db92c0a766
commit ca56ef5458
+13
View File
@@ -460,8 +460,14 @@ def perform_ota(
(upload_size >> 8) & 0xFF,
(upload_size >> 0) & 0xFF,
]
# The device erases flash between receiving the size and acking the
# prepare, so this window shows the erase cost (near zero when the
# device erases lazily during the upload)
prepare_start = time.perf_counter()
send_check(sock, upload_size_encoded, "binary size")
receive_exactly(sock, 1, "update prepare result", RESPONSE_UPDATE_PREPARE_OK)
prepare_duration = time.perf_counter() - prepare_start
_LOGGER.info("Preparing for upload took %.2f seconds", prepare_duration)
upload_md5 = hashlib.md5(upload_contents).hexdigest()
_LOGGER.debug("MD5 of upload is %s", upload_md5)
@@ -534,6 +540,13 @@ def perform_ota(
except OTANetworkError as err:
raise _committed_error(err) from err
_LOGGER.info(
"OTA took %.2f seconds total (prepare %.2f, upload %.2f)",
time.perf_counter() - prepare_start,
prepare_duration,
duration,
)
try:
send_check(sock, RESPONSE_OK, "end acknowledgement")
except OTANetworkError as err: