To find the number of cores available to you in Termux you run:
grep Cpus_allowed /proc/self/status
This number of cores is limited in a similar way to running
taskset on GNU/Linux.
I am trying to be able to predict what that will return.
According to the app CPU-Z my phone (Huawei Smart P) has 1 HiSilicon Kirin 659 with 8 cores. According to the app CPU Info 4 cores are running the same speed (480-1709Mhz) and 4 cores are running the same speed (1402-2362Mhz).
After booting the phone and waiting 5 minutes to make sure all startup tasks have been started/completed I started Termux, login through
ssh and got:
Which is exactly what I expect.
But if I press the home key, I get:
I thought this might have to do with how hard the cores are loaded, so I switched to Termux again, started 16
bzip2s. This does not change the number of cores I get immediately. But after 30s I get 4 cores:
And yet later I get bumped back to 2 cores:
This behaviour happens through
ssh whether Termux is in the foreground or background.
The effect of the home key is only when running Termux: If I run CPU Info, then press home and then start Termux, then Termux still has 8 cores:
Only when I switch away from Termux using the home key, the app-list key, or the back key does the number of CPUs change.
Software controlled big.LITTLE could explain going from 8 to 4 cores if the limit was not enforced immediately after boot, but only activated later. Since the limit is not activated 5 minutes after boot, I think it is safe to reject this as the explanation. Also it does not explain limiting to 2 cores some of the time when running 16
What is causing the phone to limit me from using 8 cores? How can I tell the phone not to do so? What is causing the limit to jump between 2 and 4 cores at seemingly random intervals?
(On top of this I had expected the cores to run at 100% speed which also does not happen).
The limitation does not happen if not run through
ssh or if run in a
tmux session where the
tmux session is started.