News for hackers. Stuff that matters.
Re:How to intentionally throttle CPU on a M1 MacBook? by xenonite on Monday October 31, 2022 @10:07AM (#33405855)
The M1 chips have two types of cores: high-performance "Firestorm" cores and energy-efficient "Icestorm" cores, which are much slower.

It is indeed possible to constrain a process to the Icestorm cores using taskpolicy:

> taskpolicy -b -p 567

where 567 needs to be replaced by the process id.

Reference: https://eclecticlight.co/2022/10/20/making-the-most-of-apple...

Re:How to intentionally throttle CPU on a M1 MacBook? by dsnr on Monday October 31, 2022 @10:18AM (#33406046)
This is some TIL material, and looks like a really viable option.
Re:How to intentionally throttle CPU on a M1 MacBook? by jonpurdy on Monday October 31, 2022 @11:23AM (#33407098)
You can also do this with GUI apps like App Tamer※. I use this myself to limit CPU consumption of hidden background apps (but not visible apps in the background), optionally running on the Icestorm cores only as well. Lots of options and ways of being configured.

※ - https://www.stclairsoft.com/AppTamer/index.html

Re:How to intentionally throttle CPU on a M1 MacBook? by kelsolaar on Tuesday November 01, 2022 @03:59AM (#33418244)
Awesome app, thanks for sharing!
Re:How to intentionally throttle CPU on a M1 MacBook? by gcanyon on Monday October 31, 2022 @11:27AM (#33407156)
This makes me want to constrain every web page to the icestorm cores. If a web page wants more than ~5% of a CPU, I want that web page to die.

Actually, now that I think about it, I'm almost tempted to write a script to do just that, and either relegates CPU-hogging processes to the icestorm cpus or just kill -stop <process id> them

Re:How to intentionally throttle CPU on a M1 MacBook? by juliusgeo on Monday October 31, 2022 @12:30PM (#33408188)
I tried to implement what you said on my M1 2020 MBP. Heres's the one liner (albeit using 0% of CPU as the cutoff, and only throttling Safari processes):

  ps axo pid,%cpu,command -r | awk '{ if ($2 >= 0 && $3~/WebContent/ )   { print $1 } }' | xargs -L 1 taskpolicy -b -p

You could set this up to run at whatever interval, and it should work. Using browserbenchmark.org, before running this one liner I get a score of 274. Afterwards, I get a score of 33.6.
Re:How to intentionally throttle CPU on a M1 MacBook? by MonkeyClub on Monday October 31, 2022 @01:15PM (#33409065)
https://browserbench.org/ (instead of ..benchmark..), right?
Re:How to intentionally throttle CPU on a M1 MacBook? by juliusgeo on Monday October 31, 2022 @01:31PM (#33409397)
Oops, my bad. That's correct.
Re:How to intentionally throttle CPU on a M1 MacBook? by MonkeyClub on Tuesday November 01, 2022 @04:39PM (#33427167)
Ugh, I ran it, then sat back amazed: I hadn't realized my computer is so crap!
Re:How to intentionally throttle CPU on a M1 MacBook? by juliusgeo on Monday October 31, 2022 @01:34PM (#33409443)
One caveat to note[1] is that apparently you cannot promote those threads back onto the performance cores using setpolicy.

[1] https://eclecticlight.co/2022/01/24/how-you-cant-promote-thr...

Re:How to intentionally throttle CPU on a M1 MacBook? by gcanyon on Tuesday November 01, 2022 @07:41PM (#33429401)
I would be perfectly fine with that.
Re:How to intentionally throttle CPU on a M1 MacBook? by gcanyon on Tuesday November 01, 2022 @07:44PM (#33429434)
This looks awesome! I already have a periodic script that archives my desktop and downloads (clean desktop for life!) but it only runs hourly. That said, it would be worth it to run this every minute, or maybe even more often. I assume this is almost zero-weight to run, but we'll see about that.
Re:How to intentionally throttle CPU on a M1 MacBook? by dsnr on Monday October 31, 2022 @11:38AM (#33407340)
One thing I noticed is that browser tabs each have their own process id. Would applying the policy on the main process affect each child tab process?
Re:How to intentionally throttle CPU on a M1 MacBook? by AA-BA-94-2A-56 on Monday October 31, 2022 @03:52PM (#33411884)
I had a piece of software that did this, and it turned out the energy-efficient cores are still really fast.