Skip to content

Commit ea74a90

Browse files
test onroad: CPU usage test improvements (commaai#24035)
* test onroad: CPU usage test improvements * remove those
1 parent e91613b commit ea74a90

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

selfdrive/test/test_onroad.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
PROCS.update({
5757
"./loggerd": 70.0,
5858
"selfdrive.controls.controlsd": 31.0,
59-
"./camerad": 36.8,
59+
"./camerad": 41.0,
6060
"./_ui": 33.0,
6161
"selfdrive.controls.plannerd": 11.7,
6262
"./_dmonitoringmodeld": 10.0,
@@ -106,6 +106,7 @@ def check_cpu_usage(first_proc, last_proc):
106106
r = True
107107
dt = (last_proc.logMonoTime - first_proc.logMonoTime) / 1e9
108108
for proc_name, normal_cpu_usage in PROCS.items():
109+
err = ""
109110
first, last = None, None
110111
try:
111112
first = [p for p in first_proc.procLog.procs if proc_name in p.cmdline][0]
@@ -115,15 +116,16 @@ def check_cpu_usage(first_proc, last_proc):
115116
if cpu_usage > max(normal_cpu_usage * 1.15, normal_cpu_usage + 5.0):
116117
# cpu usage is high while playing sounds
117118
if not (proc_name == "./_soundd" and cpu_usage < 65.):
118-
result += f"Warning {proc_name} using more CPU than normal\n"
119-
r = False
119+
err = "using more CPU than normal"
120120
elif cpu_usage < min(normal_cpu_usage * 0.65, max(normal_cpu_usage - 1.0, 0.0)):
121-
result += f"Warning {proc_name} using less CPU than normal\n"
122-
r = False
123-
result += f"{proc_name.ljust(35)} {cpu_usage:.2f}%\n"
121+
err = "using less CPU than normal"
124122
except IndexError:
125-
result += f"{proc_name.ljust(35)} NO METRICS FOUND {first=} {last=}\n"
123+
err = f"NO METRICS FOUND {first=} {last=}\n"
124+
125+
result += f"{proc_name.ljust(35)} {cpu_usage:5.2f}% ({normal_cpu_usage:5.2f}%) {err}\n"
126+
if len(err) > 0:
126127
r = False
128+
127129
result += "------------------------------------------------\n"
128130
print(result)
129131
return r

0 commit comments

Comments
 (0)