reduce shutdownd CPU usage (#23723)

* reduce shutdownd CPU usage

* sync

Co-authored-by: Comma Device <device@comma.ai>
pull/23725/head
Adeeb Shihadeh 3 years ago committed by GitHub
parent 48e97b7872
commit 4c766934be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      selfdrive/hardware/eon/shutdownd.py
  2. 1
      selfdrive/test/test_onroad.py

@ -8,17 +8,25 @@ from selfdrive.hardware.eon.hardware import getprop
from selfdrive.swaglog import cloudlog from selfdrive.swaglog import cloudlog
def main(): def main():
prev = b""
params = Params() params = Params()
while True: while True:
# 0 for shutdown, 1 for reboot with open("/dev/__properties__", 'rb') as f:
prop = getprop("sys.shutdown.requested") cur = f.read()
if prop is not None and len(prop) > 0:
os.system("pkill -9 loggerd")
params.put("LastSystemShutdown", f"'{prop}' {datetime.datetime.now()}")
time.sleep(120) if cur != prev:
cloudlog.error('shutdown false positive') prev = cur
break
# 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) time.sleep(0.1)

@ -49,6 +49,7 @@ PROCS = {
if EON: if EON:
PROCS.update({ PROCS.update({
"selfdrive.hardware.eon.androidd": 0.4, "selfdrive.hardware.eon.androidd": 0.4,
"selfdrive.hardware.eon.shutdownd": 0.4,
}) })
if TICI: if TICI:

Loading…
Cancel
Save