当我在Android中使用cgroup
作为cpu限制时,我发现它不起作用,我编写了测试演示,我启动了4个线程,而cpu是97%,然后我回到后台并我的应用是4:cpu:/bg_non_interactive
,但是cpu仍然是97%,但不是10%。...
new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while(true) {
i++;
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while(true) {
i++;
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while(true) {
i++;
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while(true) {
i++;
}
}
}).start();
PID PR CPU% S #THR VSS RSS PCY UID Name
1841 1 97% S 24 869604K 45368K bg u0_a502 com.xxx.eventdemo
34 2 0% S 1 0K 0K fg root kconsole
4869 2 0% R 1 2184K 948K fg root top
646 1 0% S 4 5716K 1424K fg media_rw /system/bin/sdcard
130|root@rk3288:/dev/cpuctl # cat /proc/1841/cgroup
4:cpu:/bg_non_interactive
2:memory:/sw
1:cpuacct:/uid_10502/pid_1841