konkor / cpufreq

System Monitor and Power Manager
https://konkor.github.io/cpufreq/
GNU General Public License v3.0
578 stars 60 forks source link

Make custom profiles system? #12

Closed konkor closed 7 years ago

konkor commented 7 years ago

Ability to create/save new profiles and apply them.

konkor commented 7 years ago

I can't see any rational reason to do this yet...

RicardoEPRodrigues commented 7 years ago

May I ask why not yet?

konkor commented 7 years ago

@RicardoEPRodrigues we have talked about it at #14. And nobody replayed to this issue. So what do you wanted from profiles exactly? PS: I have a few ideas for now with #19 maybe i'll do some profiles there and a daemon for it. So i have been testing a lot the extension without other extensions and what i'm missing is CPU temperature and i'm thinking about optional support for coretemp module.

konkor commented 7 years ago

@RicardoEPRodrigues I want make this extension lighter as possible so.

RicardoEPRodrigues commented 7 years ago

Personally I would create 3 profiles and maybe it can go as an example.

It would be easier to switch from one to another with profiles, but for now I have to make all the changes manually.

I agree that the extension must be light.

konkor commented 7 years ago

Nice. I'll reopen this issue) I'd not recommend to use 1 core even for Powersave Mode modern OSs and kernel works better on 2 cores to avoid overheating and CPU thermal throttle.

konkor commented 7 years ago

New branch profiles. It's not complete yet. Very 1st screenshot: screenshot from 2017-05-03 21 12 03 PS: I have an idea to move New ... to Preferences->New Profile ... What do you think?

konkor commented 7 years ago

OK we have this now: screenshot from 2017-05-04 11 31 56

RicardoEPRodrigues commented 7 years ago

I can't add new profiles :cry: I write the name of the new profile then I hit enter nothing happens, try to click check mark and it turns back to New....

I think that for now the New... should be at the bottom of the profile list.

konkor commented 7 years ago

@RicardoEPRodrigues There is no keyboard handler yet. Press OK icon to add a profile. It's collecting settings and add menu entry but u can't save now. I want be sure in the format before savings... I'll write when it's completely ready for testings. gtk-ok

RicardoEPRodrigues commented 7 years ago

So for now I can't save profiles right? Just to be sure :smile: The OK icon is the check mark correct?

When I press the check mark, OK icon, it does not add a profile. It returns to New.... Is it the correct behavior?

konkor commented 7 years ago

@RicardoEPRodrigues ty again) U are n1!!! It's look like in new gtk versions this events masked.

konkor commented 7 years ago

@RicardoEPRodrigues It was a bug. Yesterday I reported this bug. And today It is closed. TY for improving Gnome :) So this bug is affected 4 Gnome versions for 1.5 years. And It will be fixed in Gnome shell 3.24.2 + only. Well I'm going to add keyboard handlers (Enter, Esc) It'd aid to resolve this issue for affected shells versions. Other way It's to add own button to replace 1 broken. Heh I don't like extra code...

konkor commented 7 years ago

OMG The Profiles makes about +50% of the master code. If someone test it I would be glad to see some comments profiles.zip

RicardoEPRodrigues commented 7 years ago

It works like a charm.

Yet I'm having trouble understanding when the profile is saved. Could you explain it a little bit?

How to create a profile 101.

konkor commented 7 years ago

@RicardoEPRodrigues when you select 'New...' and enter some name (My very own Profile :)) press Return or OK button... that it. To switch profile you have to select profile. If you want remember profile for next boot u should switch ON Preferences->'Remember Settings' (if it's off) and select profile name. To rename profile select (properties). to delete press last icon.

konkor commented 7 years ago

@RicardoEPRodrigues So It's saving profile at same time u created some profile. Even if 'Remember Settings' option is OFF.

konkor commented 7 years ago

There is keyboard hotkeys in edit mode too. 'Esc' - cancel edit and 'Enter/Return' to save changes.

RicardoEPRodrigues commented 7 years ago

Is it possible that the UI allows saving changes to a profile? Maybe a button next to edit or something like that. Maybe another button may make the UI too crowded, but it would help the users make all changes with a mouse only.

konkor commented 7 years ago

No. I think It's too much for me. I like minimalism so and don't like to add extra code. So profile creating is not an everyday task. There is no difficulty to create some new profile even with same name and delete old. Just make once your settings and give it a name. I want to add more important functionality to extension so i want to keep it light like possible.


PS: So it's no difficulty to make it. Maybe we leave it for now only. There is one problem: remember all changes in edit mode or only on the saving (enter or OK). It's like 2 extra strings... @RicardoEPRodrigues LoL But there is other problem when it's going to edit mode should it load profile before editing? Bcs now it's allow you just renaming and doesn't require loading the editing profile. Ehh, one question creates 2 other...

konkor commented 7 years ago

@RicardoEPRodrigues Don't blame me if my commends sound hard. I just want to discuss and make good for the project. I really appreciate all your comments and opinions!

RicardoEPRodrigues commented 7 years ago

@konkor I do like to have these conversations. What I'm thinking is that the Edit mode is almost optional.

I was thinking that if you can easily create a new profile, why not just remove the edit mode. Less confusion on when does it save.

Just an idea. :smile:

konkor commented 7 years ago

@RicardoEPRodrigues maybe you are right. Actually It's not edit mode just renaming mode. I can hide edit button for now... wasted time heh

konkor commented 7 years ago

@RicardoEPRodrigues Eh, here is full editing support now. You can set parameters before and while editing. Press OK or Enter to apply changes. Press outside text entry or Esc to cancel editing. Now is it OK? xD


So just to rename profile you have to load profile before editing!!!

RicardoEPRodrigues commented 7 years ago

It's OK :smile:

I noticed I have an issue when changing profiles. I have the Default (Min 0%, Max 100%, Turbo Off), Performance(Min 100%, Max 100%, Turbo On) and Powersaver(Min 0%, Max 0%, Turbo Off, 4 Cores).

When I change from Default or Performance to Powersaver it seems that it doesn't disable the cores, but sets the Max 0% to the 4 active ones.

konkor commented 7 years ago

@RicardoEPRodrigues Are you still on `intel_pstate'? I'm testing now on intel pstate mode and can't reproduce ur issue. Can you recreate broken profile? It seems like you created profile too fast. The changing of active cores needs 2 seconds to avoid kernel often calls from the core slider.

konkor commented 7 years ago

@RicardoEPRodrigues One more I would recommend you in the your Performance Profile set Min at least 80% in the intel pstate mode especially for laptops! Because in the intel pstate mode 100% equal to nominal frequency + turbo boost frequency (about 120%)!!!!! That can easy overheat your CPU because laptops cooling system is very weak even on Dell or Mac.

RicardoEPRodrigues commented 7 years ago

I recreated the profiles and opened up System Monitor. It says I have 4 active CPUs. Yet the indicator still says the frequency is about 3.4GHz when it should be 800 MHz.

I think it may be counting inactive cores...

konkor commented 7 years ago

No, it doesn't count inactive core threads. Are you still on Ubuntu Gnome 17.04? I'm going to test it bcs it looks like other bug :( Usually It can show high frequency when applying some profile bcs the extension stops all events but in few seconds you should see updating on the frequency indicator...

RicardoEPRodrigues commented 7 years ago

When I switch between Performance and my Default it works fine after a couple of seconds, but in Powersaver, when I disable cores, it doesn't change.

konkor commented 7 years ago

@RicardoEPRodrigues can you show me output of

ls /sys/devices/system/cpu/cpu7/topology

for cpu 7,6,5,4 when you have 4 active CPU...

RicardoEPRodrigues commented 7 years ago

When they are active I see this:

core_id        core_siblings_list   thread_siblings core_siblings  physical_package_id  thread_siblings_list

When they are offline I see this:

ls: cannot access '/sys/devices/system/cpu/cpu7/topology': No such file or directory

I think it disables the cores but doesn't force the Min/Max frequency or disables the Turbo Boost. It's a weird behavior.

konkor commented 7 years ago

I have the Default (Min 0%, Max 100%, Turbo Off), Performance(Min 100%, Max 100%, Turbo On) and Powersaver(Min 0%, Max 0%, Turbo Off, 4 Cores).

@RicardoEPRodrigues What governors do you have in your profiles? I have noticed when I switch from powersave governor to performance intel driver tunes Turbo Boost automatically on... Maybe here something related I dunno

RicardoEPRodrigues commented 7 years ago

On Performance I have performance governor, on the others I have powersave. When switching from Performance to Default it works fine, maybe because I don't mess with the cores. IDK.

konkor commented 7 years ago

@RicardoEPRodrigues I think there can be a delay when kernel releases some core. I made additional call to reinit IO streams. Can you update to latest and test it again. TY very much. If It is not help. I would like you to make 2 additional steps to be sure:

  1. Turn off Remember Settings if it is.
  2. Reload Extension by pressing Preferences -> Reload If after reloading frequency indicator works well. It is the delay for sure...
RicardoEPRodrigues commented 7 years ago

The problem persists, it seems like the turbo is still turned on in the offline cores or something.

I created a second powersaver profile where I keep all the cores active and it works perfect.

If I do Performance -> Powersaver 4 cores it gets weird. If I do Performance -> Powersaver 8 cores -> Powersaver 4 cores it works well.

My kernel is 4.10.0-20-generic in Ubuntu GNOME 17.04.

konkor commented 7 years ago

So freq indicator is still sticking to Max frequency after manual Preferences -Reload??? But you have 4 cores in the system monitor? And governor shows powersave? And turbo boost off? Right?

RicardoEPRodrigues commented 7 years ago

So freq indicator is still sticking to Max frequency after manual Preferences -Reload???

Yes

But you have 4 cores in the system monitor?

Yes

And governor shows powersave?

Yes

And turbo boost off?

Yes

Thank you for your time!

konkor commented 7 years ago

@RicardoEPRodrigues nice. so show the output when it's sticked for cpu (0,1,2,3):

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Thank you too)

PS: I don't have near intel_pstate machine now, only remote, and can't test Ubuntu on it so. You are very helpful.

RicardoEPRodrigues commented 7 years ago

It seems the frequency is not set to a lower frequency.

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
3201599

They all have a high frequency.

konkor commented 7 years ago

@RicardoEPRodrigues It's really weird but the newest kernels just ignore requests to change frequencies if not all core/cpu threads online and selected powersave governor. I'm going to ask/report this issue at kernel.org... So it seems like affected both acpi and pstate kernel modes. I want you to test 2 things without profiles. 1st thing

  1. Turn off Remember Settings
  2. Turn on all cores, select powersave governor min 100% max 100%, Turbo on.
  3. Turn off a half cores (i guess it is 4 for u).
  4. Reduce Frequencies to 0% for example.
  5. Close the extension popup menu and reopen it.
  6. Tell me what happens with frequencies?

2nd thing -//- do the same steps but for performance governor!

Thank you.

konkor commented 7 years ago

@RicardoEPRodrigues wait... i can't reproduce it manually. It looks like delay bug in the kernel when it changing everything to quickly. I want to understand when and why exactly this happening. If u have any thoughts let me know.


Edit: ACPI mode is not affected. Kernel blocks request when min > max or max < min...

RicardoEPRodrigues commented 7 years ago

I think the work you put yourself in trying to fix this bug is too big. I think for now we should make a bug report and a notice on the experimental feature readme.

konkor commented 7 years ago

@RicardoEPRodrigues I made some changes in the sequence of profile loading. You can try. So I have tested 2 machines (2000x/3000x) with _intelpstate driver and different kernels and OS (including Ubuntu Gnome 17.04)... I can't reproduce ur issue yet :( But last patch can help if not I could increase/add extra pauses in the profile loading sequence for testing purposes especially for you... So I found some other features/abilities/bugs in the intel_pstate behavior:

  1. When all cores enabled You can't set 0% min/max frequencies in the powersave mode. But when you have performance or disabled cores It's working well.

@RicardoEPRodrigues Disable Remember Setting option for tests pls because You can't tell for sure where is an error.

RicardoEPRodrigues commented 7 years ago

It didn't fix the issue, but I seem to be isolated incident.

You can't reproduce the issue and I found a workaround for my problem (first setting all to 0% then disabling cores), so don't worry about this problem.

I think it might be related with my 17.04 been upgraded from 16.10.

konkor commented 7 years ago

@RicardoEPRodrigues TY for quick response. Theoretically, the core's turning on/off can take some time. Especially when the cores is busy in that time it's why i do 2 second timeouts in the main menu. So when i test on the clean system without any files and background processes like gnome-tracker, tacker-extract, databases, servers, darktable and etc it's working well. I'm going to make a timeout in 1 second after setting cores for starter. Or maybe just 2 seconds to see difference for sure... I let you know...

RicardoEPRodrigues commented 7 years ago

Maybe when changing profiles the indicator could show a loading animation or something. Is it possible?

konkor commented 7 years ago

@RicardoEPRodrigues Yeah it's good idea. I could change to (--- GHz) to example. I made patch so you are ready to test it.

RicardoEPRodrigues commented 7 years ago

Simple enough, thank you! :smile: #29

konkor commented 7 years ago

@RicardoEPRodrigues so what do u say 2 seconds working for you?