Log how much time running update_device.py took
Might be useful to quickly check how OTA optimization
(e.g. reducing time for otapreopt postinstall) are performing.
Bug: 190817237
Test: python3 system/update_engine/scripts/update_device.py --file out/dist/aosp_coral-ota-eng.ioffe.zip
Change-Id: I750fb959f1ed6d25b15c2ca05898e9415e276a8c
diff --git a/scripts/update_device.py b/scripts/update_device.py
index f672cda..165bc97 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -30,6 +30,7 @@
import sys
import struct
import tempfile
+import time
import threading
import xml.etree.ElementTree
import zipfile
@@ -441,6 +442,8 @@
logging.basicConfig(
level=logging.WARNING if args.no_verbose else logging.INFO)
+ start_time = time.perf_counter()
+
dut = AdbHost(args.s)
server_thread = None
@@ -548,6 +551,7 @@
for cmd in finalize_cmds:
dut.adb(cmd, 5)
+ logging.info('Update took %.3f seconds', (time.perf_counter() - start_time))
return 0