How to force a Terminal Command to run with the Performance Cores on Apple Silicon?
I recently had to reinstall the developer tools using xcode-select —install
, but noticed that the install was completed with my efficiency cores rather than my performance cores. I know this because iStatMenu showed me that my four efficiency cores were at 100% most of the time while the performance cores were inactive.
Is there a way I can manually set the priority of a process? Can I tell a process to run on the performance cores if needed? Ideally, it would actually use as many cores as it had threads, and run on all 8 cores simultaneously.
An answer here describes how to run a task with the efficiency cores, which is equally useful, but I couldn't figure out how to adapt that technique to use the performance cores instead.
Solution 1:
You should note that the linked to answer works by "clamping" the QoS setting for the program - i.e. effectively putting a limit on how "well" thr program should be treated by the system.
This question is actually the opposite that we want to put a limit on how "bad" the program could be treated by the system.
I.e. even if xcode-select --install
actually asks for the performance cores, it could under normal circumstances still be forced to run on efficiency cores if the performance cores are used for other things.
I would recommend starting by using taskinfo
to gain information about the specific program. I.e. start up the installation process and run the following command in the Terminal:
sudo taskinfo 1234
where 1234
is the PID of the xcode-select
process, you have started.
This will let you know a lot of useful information about the process, in particular you can see which scheduling policy is being used, the QoS clamp, and the latency and thruput QoS settings. Note that these values are shown first as the "requested policy" and then again as the "effective policy".
Depending on your system setup, I would assume that you find the reason for running on efficiency cores in the output. Then use the taskpolicy
command to set a new through tier with the -t
option or a new latency tier with the l
option. You can also use the nice
command to alter the scheduling priority.