Reduce paramsd and calibrationd CPU usage (#2119)

* reduce paramsd cpu

* reduce calibrationd cpu usage

* calibration_helpers was mostly unused

* more calibration cleanup

* update refs

* fix thresholds in CPU test
This commit is contained in:
Adeeb Shihadeh
2020-09-10 12:16:29 -07:00
committed by GitHub
parent 7cc5710974
commit e0004d0981
10 changed files with 46 additions and 81 deletions
@@ -201,16 +201,10 @@ def calibration_rcv_callback(msg, CP, cfg, fsm):
# calibrationd publishes 1 calibrationData every 5 cameraOdometry packets.
# should_recv always true to increment frame
recv_socks = []
if msg.which() == 'carState' and ((fsm.frame + 1) % 25) == 0:
frame = fsm.frame + 1 # incrementing hasn't happened yet in SubMaster
if frame == 0 or (msg.which() == 'cameraOdometry' and (frame % 5) == 0):
recv_socks = ["liveCalibration"]
return recv_socks, msg.which() == 'carState'
def paramsd_rcv_callback(msg, CP, cfg, fsm):
recv_socks = []
if msg.which() == 'carState' and ((fsm.frame + 2) % 5) == 0:
recv_socks = ["liveParameters"]
return recv_socks, msg.which() == 'carState'
return recv_socks, fsm.frame == 0 or msg.which() == 'cameraOdometry'
CONFIGS = [
ProcessConfig(
@@ -283,12 +277,12 @@ CONFIGS = [
ProcessConfig(
proc_name="paramsd",
pub_sub={
"carState": ["liveParameters"],
"liveLocationKalman": []
"liveLocationKalman": ["liveParameters"],
"carState": []
},
ignore=["logMonoTime", "valid"],
init_callback=get_car_params,
should_recv_callback=paramsd_rcv_callback,
should_recv_callback=None,
tolerance=NUMPY_TOLERANCE,
),
]
+1 -1
View File
@@ -1 +1 @@
b47257005e7408737c66463c45f5db36153a849d
5c2c99c4572d68f17ffa3a33acf8e4e205ca94c2
+2 -2
View File
@@ -19,17 +19,17 @@ def print_cpu_usage(first_proc, last_proc):
("./loggerd", 33.90),
("selfdrive.locationd.locationd", 29.5),
("selfdrive.controls.plannerd", 11.84),
("selfdrive.locationd.paramsd", 11.53),
("selfdrive.locationd.paramsd", 10.5),
("./_modeld", 7.12),
("selfdrive.controls.radard", 9.54),
("./camerad", 7.07),
("./_sensord", 6.17),
("selfdrive.locationd.calibrationd", 6.0),
("./_ui", 5.82),
("./boardd", 3.63),
("./_dmonitoringmodeld", 2.67),
("selfdrive.logmessaged", 2.71),
("selfdrive.thermald.thermald", 2.41),
("selfdrive.locationd.calibrationd", 2.0),
("selfdrive.monitoring.dmonitoringd", 1.90),
("./proclogd", 1.54),
("./_gpsd", 0.09),