Walt Mankowski via plug on 12 Dec 2021 16:34:43 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] CPU Scaling


Thanks Wayne,

As long as it's normal then I won't worry about it. This is a desktop
with a cooling system so I'm not too worried it getting too hot. OTOH,
I don't have any pressing need to overclock it, and it sounds like the
defaults use less power when it's idle.

Walt

On Sun, Dec 12, 2021 at 03:26:10PM -0800, Wayne via plug wrote:
> 
> I don't know if there is a setting that will 'lock' in the CPU speed. Most of them will vary the speed according to need. You can see what the Max speed of all the cores are currently set to with this:
> 
> p=$(nproc --ignore=1); for i in $(seq 0 $p); do cat /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq; done
> 
> You can alter the Max speed (to, say, 1.2GHz) with this:
> 
> sudo bash -c 'p=$(nproc --ignore=1); for i in $(seq 0 $p); do echo 1200000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq; done'
> 
> I do this to lower temperatures on the laptop. Resist the temptation to set it to anything higher that the Max specified speed for your CPU though. You don't want to turn your computer into a space heater.
> 
> 
> 
> On 12/12/21 2:41 PM, Walt Mankowski via plug wrote:
> > Hi,
> > 
> > As usual in December I've been working my way through the awesome Advent of Code <https://adventofcode.com/>problems. (This year we're saving Christmas by riding around in a submarine. Don't ask.)
> > 
> > While working on today's problem <https://adventofcode.com/2021/day/12> I noticed that my code ran about twice as fast on my Apple laptop than my Ubuntu desktop, despite the fact that my desktop's CPUs are over 50% faster (3.5 GHz AMD vs 2.3 GHz Intel Core i7). When I looked in |/proc/cpuinfo| I saw that the "cpu MHz" field was only 1400!
> > 
> > I did some searches online and discovered this seems to be due to something called "CPU Scaling". I've looked at |/proc/cpuinfo| subsequently and I've also run |cpufreq-info(1)| and the numbers vary quite a bit. I'm guessing the system is dynamically adjusting the CPU speed based on the current system load.
> > 
> > I've never noticed this before so I don't know if it's been in effect for a while, or if it's something new in Ubuntu 21.10. I'm not sure yet if I want to keep it or turn it off, but I would like to know more about where it's set and how to tune it. Unfortunately most of the information I've been able to find out about it seems fairly dated and predates Ubuntu's adoption of systemd. Can anyone point me to more up to date information?
> > 
> > Thanks.
> > 
> > Walt
> > 
> > 
> > ___________________________________________________________________________
> > Philadelphia Linux Users Group         --        http://www.phillylinux.org
> > Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> > General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
> > 
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

Attachment: signature.asc
Description: PGP signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug