reduce shutdownd CPU usage (#23723)

* reduce shutdownd CPU usage

* sync

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 4c766934bed739db19cf3e1c53305b4d70500f45
This commit is contained in:
Adeeb Shihadeh
2022-02-07 18:50:54 -08:00
committed by GitHub
parent 3522f8dfad
commit 8343e21ea7
2 changed files with 17 additions and 8 deletions
+16 -8
View File
@@ -8,17 +8,25 @@ from selfdrive.hardware.eon.hardware import getprop
from selfdrive.swaglog import cloudlog
def main():
prev = b""
params = Params()
while True:
# 0 for shutdown, 1 for reboot
prop = getprop("sys.shutdown.requested")
if prop is not None and len(prop) > 0:
os.system("pkill -9 loggerd")
params.put("LastSystemShutdown", f"'{prop}' {datetime.datetime.now()}")
with open("/dev/__properties__", 'rb') as f:
cur = f.read()
time.sleep(120)
cloudlog.error('shutdown false positive')
break
if cur != prev:
prev = cur
# 0 for shutdown, 1 for reboot
prop = getprop("sys.shutdown.requested")
if prop is not None and len(prop) > 0:
os.system("pkill -9 loggerd")
params.put("LastSystemShutdown", f"'{prop}' {datetime.datetime.now()}")
os.sync()
time.sleep(120)
cloudlog.error('shutdown false positive')
break
time.sleep(0.1)
+1
View File
@@ -49,6 +49,7 @@ PROCS = {
if EON:
PROCS.update({
"selfdrive.hardware.eon.androidd": 0.4,
"selfdrive.hardware.eon.shutdownd": 0.4,
})
if TICI: