LV2: Introduce Dynamic Timer signals #16481
Open
+239
−38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For a while, the emulator has dealt with LV2 timed syscalls pretty inefficiently:
Instead, try a new thing: we know that direct thread notifications are very fast on every operaing systems, so try to systematically check for time-outs by other emulationh threads when they have little to no work themeselfs. This would eliminate the delay and cut on CPU time!
But hold on! what about times when other emulation threads do have work to be ?
The truth is that we cannot predict such cases with full accuracy, but what we can do is calculate the avarage response time of other threads to this in the past in games and see if it is valueable to opt for this mechanis instead. At the times when not, fallback to "Useleep" setting behaviour. This would provide accuracy in the "not well suited" cases too!
This adds the setting value "Dynamic" for LV2 timers accuracy, while it being the new default.
What to test:
Results: around 20% in CPU time specifically used by PPU in usleep syscalls is saved now, it's nice but it's a bit disappointing because there may be more potential there. That's it for this pr though.