CPU governor and overclock threshold
-
I was wondering if someone could help me with setting the governor to performance and so it's persistent across reboots. This command seems to work but I don't think it worked after a reboot. Also does this set it for the CPU or do you need to set it for each core?
echo "performance" |sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
The other command I was hoping to get help with is something similar to this. I think it must be for an older version as it doesn't work in the current version but I can't find the correct syntax or how to make it persistent across reboots too.
echo 60 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
I believe it supposed to set the threshold to 60% utilization before overclocking where I think the default is 95%? I thought lowering it might make it a bit snappier. I was running Gauntlet Legends on N64 and through a Putty session I saw it kept downclocking to 600 several times just booting up and sitting at the intro screen.
-
If you want to set the performance governor when running games, that is already supported
https://github.com/RetroPie/RetroPie-setup/wiki/runcommand
(It sets it on game start, and restores previous setting on game exit)
-
@BuZz said in CPU governor and overclock threshold:
If you want to set the performance governor when running games, that is already supported
https://github.com/RetroPie/RetroPie-setup/wiki/runcommand
(It sets it on game start, and restores previous setting on game exit)
Thanks Buzz! That would be exactly what I would be looking for. I did a search for governor with no hits.
A quick question when I press a key it brings up the menu with all the options except the Runcommand Launch menu. I am guessing it's option 4 CPU Configuration (it's missing the description for this option). I just don't see it as a menu item.
After reading the wiki and launching the menu these commands are not on the menu:
Starting with RetroPie 3.5 you can enable and disable different functions of the Runcommand Launch Menu. 1 Launch Menu (Enabled) 2 Launch Menu Art (Enabled) 3 Launch Menu Joystick Control (Enabled) 4 CPU Configuration
-
It is not in the pre-launch menu which is for per system/per rom configs - it is available from retropie-setup or from the retropie menu in ES.
-
@BuZz said in CPU governor and overclock threshold:
It is not in the pre-launch menu which is for per system/per rom configs - it is available from retropie-setup or from the retropie menu in ES.
Thanks Buzz, that is a perfect! :) That's better than I could have hoped for. That's a nice feature.
The only thing after I quit the game and I am sitting at the ES emulator select menu and it looks like it's staying overclocked. I am running a script from a Putty session and the output is below after about 5 minutes of watching. Unrelated 1350 was a bit dodgy on some things so I backed it down to 1300 with an overvolt 4 and it seems very stable so far.
CPU Speed: 1300 MHz CPU Temp: 50.6°C GPU Temp: 50.7°C
These are my overclock settings. I do see it bounce between 600 and 1300 from I'm guessing background tasks when at the emulator selection menu. After running a game it stays constant at 1300 but once I exit it doesn't drop down or bounce but stays at a constant 1300 still until I reboot.
#Overclock Settings arm_freq=1300 over_voltage=4 temp_limit=80 core_freq=500 #GPU Based h264_freq=333 avoid_pwm_pll=1 gpu_mem=450 v3d_freq=500 #Ram Overclock sdram_freq=588 sdram_schmoo=0x02000020 over_voltage_sdram_p=6 over_voltage_sdram_i=4 over_voltage_sdram_c=4
-
Thanks - there is a bug on the RPI - which may be due to some behaviour change in the kernel or I just missed it before when testing.
it saves the "previous" values of the CPU governors in an array, but it does this in the same loop as it sets them. On the RPI if setting cpu0 to performance, cpu1 will also be set to performance (no per core setting supported). So it gets the value performance back, and when restoring the values, it will end up leaving them in performance (or whatever was chosen).
This code works fine on my PC - as each core can be set individually. I will save the values first before setting, which should resolve it.
-
@BuZz said in CPU governor and overclock threshold:
Thanks - there is a bug on the RPI - which may be due to some behaviour change in the kernel or I just missed it before when testing.
it saves the "previous" values of the CPU governors in an array, but it does this in the same loop as it sets them. On the RPI if setting cpu0 to performance, cpu1 will also be set to performance (no per core setting supported). So it gets the value performance back, and when restoring the values, it will end up leaving them in performance (or whatever was chosen).
This code works fine on my PC - as each core can be set individually. I will save the values first before setting, which should resolve it.
So in other words a fix is needed for the kernel or the script?
-
A fix in the
runcommand.sh
so it will work correctly on machines that have multiple cores but a single governor for all.Fixed in https://github.com/RetroPie/RetroPie-Setup/commit/0951d9d3581588822a5b66e2d990f8c7b5a17341
updating retropie-setup script should sort it.
-
@BuZz That was fast thank you!
-
@BuZz said in CPU governor and overclock threshold:
A fix in the
runcommand.sh
so it will work correctly on machines that have multiple cores but a single governor for all.Fixed in https://github.com/RetroPie/RetroPie-Setup/commit/0951d9d3581588822a5b66e2d990f8c7b5a17341
updating retropie-setup script should sort it.
Great, thanks Buzz for the quick fix! Ok, dumb question so are you joolswills? I always check the commits daily. I guess I never made the connection. I saw a post on another thread by you that was WAY above my comprehension on caching and writing to improve performance.
If I can ask one question, does install Experimental packages or installs in general tax the Pi? What I mean is when I would install Daphne overclocked to 1350 I crashed every time but at 1300 it installed just fine every time. The overclock settings above are what is stable with a decent 2A (I think 5.3v) power supply for my particular Pi 3's.
-
I am.
Compiling some experimental packages will make it work yes - as it will use more than one core for compiling. So if your machine crashes, it is likely you do not really have a stable overclock (many emulators are single core, so it might seem to be stable with them, but it may not actually be a stable overclock when more than one core is in use).
-
@BuZz said in CPU governor and overclock threshold:
I am.
Compiling some experimental packages will make it work yes - as it will use more than one core for compiling. So if your machine crashes, it is likely you do not really have a stable overclock (many emulators are single core, so it might seem to be stable with them, but it may not actually be a stable overclock when more than one core is in use).
Very cool, you do some very impressive work and thank you so much for such an awesome program! :)
Ok, that makes sense it would work at higher overclocks for gaming but failed compiling Daphne so I kept lowering until Daphne successfully compiled and left it there. I figure a little overclock is better than none. I think the success of the Pi speaks for itself and the gaming will just get better with each generation of Pi. I think its here to stay.
-
Welcome (team effort of course) :)
-
@BuZz said in CPU governor and overclock threshold:
Welcome (team effort of course) :)
Perfect Buzz, it worked flawlessly. I really like this solution as it's a win-win really. People can overclock and then use the performance governor to take full advantage of the overclock when you need it most while running a game and downclock when sitting at the menu. It's brilliant really.
RetroPie is the only reason I bought a Pi (several actually). It's definitely in my top 10 coolest things of all time, RetroPie that is, the Pi alone just doesn't cut it! ;) RetroPie adds the Midas touch to the Pi. I guess you can't put a price on nostalgia! :)
-
@Riverstorm said in CPU governor and overclock threshold:
I believe it supposed to set the threshold to 60% utilization before overclocking where I think the default is 95%? I thought lowering it might make it a bit snappier. I was running Gauntlet Legends on N64 and through a Putty session I saw it kept downclocking to 600 several times just booting up and sitting at the intro screen.
i imagine it's doing this because N64 emulation doesn't really push the CPU, but rather the GPU. it just doesn't need the power.
however, the GPU down-clocks also. i wonder if they do it in tandem? might be worth experimenting with. use the command:
vcgencmd measure_clock
to measure GPU 3d clock speed in real-time -
@dankcushions said in CPU governor and overclock threshold:
@Riverstorm said in CPU governor and overclock threshold:
I believe it supposed to set the threshold to 60% utilization before overclocking where I think the default is 95%? I thought lowering it might make it a bit snappier. I was running Gauntlet Legends on N64 and through a Putty session I saw it kept downclocking to 600 several times just booting up and sitting at the intro screen.
might be worth experimenting with. use the command:
vcgencmd measure_clock
to measure GPU 3d clock speed in real-timeThanks Dank, I tried the command but I must need to install a package? It gave me an error when I ran it.
That's ok as my technical ability is pretty low unless the output is pretty self-explanatory but even then I wouldn't know how to implement any changes beyond tweaking.
I think Buzz hit the nail on the head with what I was shooting for, unless there is more performance to be gained. ;) I suppose it's diminishing returns on performance vs. tweaking on what the Pi is capable of but Twitch's thread gave me hope that there are some good N64 games that are quite playable on the Pi 3.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.