mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 03:22:07 +08:00
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:
@@ -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)
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ PROCS = {
|
||||
if EON:
|
||||
PROCS.update({
|
||||
"selfdrive.hardware.eon.androidd": 0.4,
|
||||
"selfdrive.hardware.eon.shutdownd": 0.4,
|
||||
})
|
||||
|
||||
if TICI:
|
||||
|
||||
Reference in New Issue
Block a user