-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scheduler perf dropping after 128 seconds #2304
Conversation
Test Results75 tests 75 ✅ 0s ⏱️ Results for commit e72704e. ♻️ This comment has been updated with latest results. |
@@ -386,6 +387,9 @@ void TaskManager::start(double duration) { | |||
if (duration != 0) { | |||
mustEndBefore = startTime + duration; | |||
} | |||
else { | |||
mustEndBefore = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just set this in the constructor? There's no reason to initialize it to 128 anymore, it was a holdover from before the clock rolled properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was weird to ignore the duration
parameter if it is zero, it will not work if you call start()
first with a timeout and later without a timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm true
Currently, there is a massive increase in scheduler overhead happening after roughly 128 seconds after boot up. As an example, here is scheduler stats before and after when the deluge is idle in an empty song: Before (typical numbers): task_scheduler.cpp:451: Dumping task manager stats: (min/ average/ max) task_scheduler.cpp:470: Load: 84.20 Average Duration: 13.628 Times Called: 340283, Task: audio routine task_scheduler.cpp:470: Load: 1.59 Average Duration: 5.730 Times Called: 19062, Task: read encoders ...... task_scheduler.cpp:478: Working time: 55.94, Overhead: 44.20. Total running time: 120.00 seconds After (typical numbers): task_scheduler.cpp:451: Dumping task manager stats: (min/ average/ max) task_scheduler.cpp:470: Load: 58.62 Average Duration: 33.665 Times Called: 18188, Task: audio routine task_scheduler.cpp:470: Load: 4.59 Average Duration: 4.393 Times Called: 9922, Task: read encoders .... task_scheduler.cpp:478: Working time: 10.06, Overhead: 89.94. Total running time: 140.00 seconds After chasing a few false ends (I was convinced it was a rollover related bug, as rolltime is 128.86 seconds), there is a bug in chooseBestTask() as the deadline is not being setup anymore, which leads to the default value of `double mustEndBefore = 128;` being unchanged. after this, most logic in chooseBestTask stops working as intended. To fix it, add a proper check for running the scheduler without deadline.
91f5c69
Currently, there is a massive increase in scheduler overhead happening after roughly 128 seconds after boot up. As an example, here is scheduler stats before and after when the deluge is idle in an empty song:
After chasing a few false ends (I was convinced it was a rollover related bug, as rolltime is 128.86 seconds), there is a bug in chooseBestTask() as the deadline is not being setup anymore, which leads to the default value of
double mustEndBefore = 128;
being unchanged. after this, most logic in chooseBestTask stops working as intended.To fix it, add a proper check for running the scheduler without deadline.