|
|
@ -120,8 +120,8 @@ class TestOnroad(unittest.TestCase): |
|
|
|
if "DEBUG" in os.environ: |
|
|
|
if "DEBUG" in os.environ: |
|
|
|
segs = filter(lambda x: os.path.exists(os.path.join(x, "rlog")), Path(ROOT).iterdir()) |
|
|
|
segs = filter(lambda x: os.path.exists(os.path.join(x, "rlog")), Path(ROOT).iterdir()) |
|
|
|
segs = sorted(segs, key=lambda x: x.stat().st_mtime) |
|
|
|
segs = sorted(segs, key=lambda x: x.stat().st_mtime) |
|
|
|
print(segs[-1]) |
|
|
|
print(segs[-2]) |
|
|
|
cls.lr = list(LogReader(os.path.join(segs[-1], "rlog"))) |
|
|
|
cls.lr = list(LogReader(os.path.join(segs[-2], "rlog"))) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
# setup env |
|
|
|
# setup env |
|
|
@ -187,6 +187,25 @@ class TestOnroad(unittest.TestCase): |
|
|
|
big_logs = [f for f, n in cnt.most_common(3) if n / sum(cnt.values()) > 30.] |
|
|
|
big_logs = [f for f, n in cnt.most_common(3) if n / sum(cnt.values()) > 30.] |
|
|
|
self.assertEqual(len(big_logs), 0, f"Log spam: {big_logs}") |
|
|
|
self.assertEqual(len(big_logs), 0, f"Log spam: {big_logs}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_ui_timings(self): |
|
|
|
|
|
|
|
result = "\n" |
|
|
|
|
|
|
|
result += "------------------------------------------------\n" |
|
|
|
|
|
|
|
result += "-------------- UI Draw Timing ------------------\n" |
|
|
|
|
|
|
|
result += "------------------------------------------------\n" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ts = [m.uiDebug.drawTimeMillis for m in self.lr if m.which() == 'uiDebug'] |
|
|
|
|
|
|
|
result += f"min {min(ts):.2f}ms\n" |
|
|
|
|
|
|
|
result += f"max {max(ts):.2f}ms\n" |
|
|
|
|
|
|
|
result += f"std {np.std(ts):.2f}ms\n" |
|
|
|
|
|
|
|
result += f"mean {np.mean(ts):.2f}ms\n" |
|
|
|
|
|
|
|
result += "------------------------------------------------\n" |
|
|
|
|
|
|
|
print(result) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertGreater(len(ts), 20*50, "insufficient samples") |
|
|
|
|
|
|
|
self.assertLess(max(ts), 30.) |
|
|
|
|
|
|
|
self.assertLess(np.mean(ts), 10.) |
|
|
|
|
|
|
|
self.assertLess(np.std(ts), 5.) |
|
|
|
|
|
|
|
|
|
|
|
def test_cpu_usage(self): |
|
|
|
def test_cpu_usage(self): |
|
|
|
proclogs = [m for m in self.lr if m.which() == 'procLog'] |
|
|
|
proclogs = [m for m in self.lr if m.which() == 'procLog'] |
|
|
|
self.assertGreater(len(proclogs), service_list['procLog'].frequency * 45, "insufficient samples") |
|
|
|
self.assertGreater(len(proclogs), service_list['procLog'].frequency * 45, "insufficient samples") |
|
|
|