查看系统所有的CPU
1 2 3 4 5 6
| blueline:/sys/devices/system/cpu $ ls core_ctl_isolated cpu2 cpu5 cpufreq hang_detect_gold isolated offline power cpu0 cpu3 cpu6 cpuidle hang_detect_silver kernel_max online present cpu1 cpu4 cpu7 gladiator_hang_detect hotplug modalias possible uevent blueline:/sys/devices/system/cpu $ cat possible 0-7
|
查看所有正在运行的核
1 2 3
| blueline:/sys/devices/system/cpu $ cat online 0-7 blueline:/sys/devices/system/cpu $
|
查看所有的未在运行的核
1 2 3 4 5
| blueline:/sys/devices/system/cpu $ cat online 0-7 blueline:/sys/devices/system/cpu $ cat offline
blueline:/sys/devices/system/cpu $
|
查看CPU0所有的相关信息
1 2 3 4 5
| blueline:/sys/devices/system/cpu $ cd cpu0/ blueline:/sys/devices/system/cpu/cpu0 $ ls cache cpufreq hotplug of_node power rq-stats subsystem uevent core_ctl cpuidle isolate online regs sched_load_boost topology blueline:/sys/devices/system/cpu/cpu0 $
|
查看CPU0是否正在运行状态
1 2 3
| blueline:/sys/devices/system/cpu/cpu0 $ cat online 1 blueline:/sys/devices/system/cpu/cpu0 $
|
我们可以0写入到当前CPU0的online文件中,这个CPU的核就关闭了。
1 2 3 4 5 6 7 8 9
| blueline:/sys/devices/system/cpu/cpu0 $ echo 0 > online /system/bin/sh: can't create online: Permission denied 1|blueline:/sys/devices/system/cpu/cpu0 $ remount /system/bin/sh: remount: not found 127|blueline:/sys/devices/system/cpu/cpu0 $ su blueline:/sys/devices/system/cpu/cpu0 # echo 0 > online blueline:/sys/devices/system/cpu/cpu0 # cat online 0 blueline:/sys/devices/system/cpu/cpu0 #
|
这个时候我们在回到外面一层文件里面的onlin文件和offline文件。我们可以看到对应的核已经关闭掉
1 2 3 4 5
| blueline:/sys/devices/system/cpu # cat online 1-7 blueline:/sys/devices/system/cpu # cat offline 0 blueline:/sys/devices/system/cpu #
|
这个时候我们再去看看当前正在运行的核心