如何在强力CPU核心上运行Termux程序?
我的手机有一个 ARM big.LITTLE cpu,我正在制作一个将永远运行的程序
while(1) {
do_stuff();
sleep_seconds(60);
}
,并且 do_stuff() 函数可能使用太多的 cpu,以至于每次运行时都会唤醒性能核心..我想避免如果可能的话。我可以推测,给它尽可能低的CPU优先级,
setpriority(PRIO_PROCESS, 0, 19);
可能会成功,但这只是一个疯狂的猜测,我不知道这是否真的有效......帮忙?
my phone has an ARM big.LITTLE cpu, and i'm making a program that will run forever
while(1) {
do_stuff();
sleep_seconds(60);
}
and that do_stuff() function probably use so much cpu that it wakes up a performance-core every time it runs.. i want to avoid that if possible. i can theorize that giving it the lowest possible cpu priority,
setpriority(PRIO_PROCESS, 0, 19);
might do the trick, but that's just a wild guess, i have no idea if that actually works or not.. help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我想了!假设有效的核心是最高频率最低的核心(我认为总是如此?),我们可以使用
to deduce which cores are the performance cores and which cores are the power-efficient cores, then we can use
tasket
to restrict ourselves to那些核心。 for example on my Mediatek Helio G95 (Ulefone Power Armor 13):here the last 2 cores are the performance cores.. and thus we can use
to restrict PID to only the power-efficient cores. example implementation in PHP:
prints:
success!
i think i figured it out! assuming that the power-efficient cores are the cores with the lowest max frequency (i think that is always the case?), we can use
to deduce which cores are the performance cores and which cores are the power-efficient cores, then we can use
tasket
to restrict ourselves to those cores. for example on my Mediatek Helio G95 (Ulefone Power Armor 13):here the last 2 cores are the performance cores.. and thus we can use
to restrict PID to only the power-efficient cores. example implementation in PHP:
prints:
success!