-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add min/max allowed frequencies option (#309) #324
Conversation
Setting the minimum/maximum allowed CPU frequencies is now possible via 'scaling_min_freq' and 'scaling_max_freq' options in config for both modes (charger and battery). Values should be given in kHZ. Example: scaling_min_freq = 1800000 scaling_max_freq = 2000000 I also did autoformatting via 'black', using --line-length 100. Code is now a bit tidier than before.
Thank you for your work on auto-cpufreq! When we have time we look into this. One tip in general when contributing a feature. Don't run code formatters, do it as a seperate PR. But overall, thank you! |
Okay, I'll create a separate PR for the reformatted base commit of my feature, so once it's delivered I can rebase this one on it, for making it easier to read. Reformatted codebase patch: #325 |
@varaki could you please resolve the conflicts before I get to review this? Thank you |
From just reading the code it looks good! I will let the testing to @AdnanHodzic But I have one question, why do you use regex for this?
Would detecting a ValueError on int() not be easier? |
1: Code changes LGTM, but there's one problem where if there is no
2: When it comes to testing the changes. Setting the limits didn't seem to make any difference and it seems defined limits were not respected. 3: README/Example config contents:
3.1:
I would lower 3.2: On this topic mentioned above, what should happen if I say 3.3: I would disable/comment 3.4: MHz to Hz conversion can be bit configuring for a random Joe, so I would also add a link to i.e: MHz to Hz conversion for further reference as part of the description. |
Good catch, thanks. A string.isidigit() check would also suffice. |
I'll push my changes addressing all observations soon. |
Should do it I think, that would make freq_val an int or raises an error when it couldn't make an int out if it. |
What is the difference between --frequency-min/max and the new --frequency-min/max-limit in Ah I see. One is cpuinfo_freq and the other is scaling_freq. On my system it gives the same results. Sorry. |
@varaki please don't consider this as me trying to rush you (especially during a holiday!) but I was thinking of making a new release tomorrow and would love if these changes could be part of it. If you're close to finishing I can also wait and do the release next week. If not we can also make these changes as part of a new release next year, it all works for me, just let me know so I can plan, thanks! |
Hi, with the latest commit, I consider it done, I think I implemented all changes suggested last time. I also tested it, works for me too. |
Okay good to know, wasn't aware it was ready for review again. Will take another look tomorrow and if it's all good will merge it with |
@varaki verified everything, excellent work and of course thank you for your contribution! |
Great, let's see how it works for a broader audience 🙂 |
We'll find out soon as v1.9.0 release is live and I'll tap you if I see issues/questions popping up related to this :) |
@varaki in meantime I found one bug which should be fixed. If you're using It would be great if they could be reverted back to defaults, as soon as it's detected |
One way to reset the original frequencies, is the "comment out in the config, then reboot way". |
Awesome, thank you! |
How do we know whether the scaling frequencies were set by auto-cpufreq before or not? Pull request ready for review: #338 |
Issue permanently resolved as part of 1.9.1 release. |
Setting the minimum/maximum allowed CPU frequencies is now possible
via 'scaling_min_freq' and 'scaling_max_freq' options in config
for both modes (charger and battery).
Values should be given in kHZ.
Example:
scaling_min_freq = 1800000
scaling_max_freq = 2000000
I also did autoformatting via 'black', using --line-length 100.
Code is now a bit tidier than before.