-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
SetFrameRate thread wait CPU issue #8405
Comments
We can solve the CPU usage (measure) issue by just changing
to
It will fix the CPU usage measuring (more on that later if needed) we can decrease a bit the 36ms also, but it increases FPS jitter cc @danomatika @artificiel @ofTheo ![]() ![]() |
I'd reiterate the principle of implementing this as a new time mode instead of replacing an existing one — enabling the user to determine if they want a fixed frame with no CPU cycles (previous behaviour), or fixed frame rate with tighter timing but higher CPU cycles by calling that way we can experiment with this new approach without forcing all the OF projects that call |
My thought is more to leave it as it was but provide either an option to turn on high frequency timing and/or provide a callback or way for users to implement their own idle function. AN associated example might be helpful too. I feel like this is one of those things that can be highly dependent upon the project. It reminds me of audio projects where some users are fine with 16ms+ latency while a few require 2ms always however that is going to burn CPU so most programs do not enable by default. EDIT: Also, please please please document the pros and cons of this. We want to avoid the inevitable issue where someone complains that they turned on the cool sounding option but now their app now burns through battery and they don't know why when it didn't before... but it sure is smooth. 😄 I think the naming should be carefully chosen if it is an *enable function. |
Great @danomatika let us know which is the ideal place to discuss other than the discussion already existent in the PR. Ideas: But it is only my opinion and I'm good if anybody wants it reverted |
I like your suggestion @dimitre
and the option to switch to more precise if needed. |
Ok the option for more precision is not needed for 0.12.1. |
I'd prefer if there were three frame rate precision/timing options: none (as before), low, and high. I had no issues with how things were before and frame rate consistency has really never been an issue for my projects. |
Also, on some projects which poll sensors or events in a loop, I provide an idle/sleep time option on the command line to fine tune it by setting you own value in ms/us etc. Maybe this would work and the presents would be number defines with none being 0, a special case to turn it off. UPDATE: Maybe something like: #define OF_FRAMERATE_SLEEP_NONE 0
#define OF_FRAMERATE_SLEEP_LOW 8
#define OF_FRAMERATE_SLEEP_HIGH 32
// set the frame rate idea sleep timing in us,
// lower values improve frame rate jitter (aka smoother) but use higher CPU
ofSetFrameRateSleep(unsigned int t); I haven't looked at the actual values, so 8 and 32 are guesses. |
Also, to explain my reasoning to keep "none" as default for now:
I am not against this on a whole, just the move toward making it default right now. |
actually 3 things are happening within the PR:
as a whole, this is arguably are an enhancement, but (a) and (b) have enough effect to throw off existing projects/expectations (as per @danomatika's reaction) and additionally are not fixing a well-defined problem. as such it is evident that the change is controversial and should not be introduced as a default, even if the CPU usage symptom is fixed, as the ramifications of the change may be deeper than apparent. given that OF already supports NB there is also room for API improvement, as the "timeMode" concept is used in many classes, sometimes differently such as when setting to Filtered, the Events are Filtered, but the actual clock stays System; this suggest the different timeMode-related methods and enums should be more precisely named to diminish ambiguity and facilitate understanding of the relationships between these. openFrameworks/libs/openFrameworks/utils/ofUtils.cpp Lines 302 to 303 in 3dff4e2
|
I think so too. The |
The text was updated successfully, but these errors were encountered: