1. 设置CPU为性能模式,提高CPU工作频率
cpupower -c all frequency-set -g performance
2.设置CPU为节能模式
cpupower -c all frequency-set -g powersave
3. cpupower idle-info 可以查看到当前支持C state,cpupower idle-set -D 2 来关闭大于2ns 的C status,这样可以让CPU 一直处于C0 状态;这里需要注意到系统所用 的驱动,有的是ACPI驱动,有的是intel 驱动,驱动不同关系是否会成功调用BIOS设定
另外在grub 文件中设定intel_idle.max_cstate=0 inte intel_pstate=disable idle=poll等都可以禁止CPU节能模式
例如 使用vim编辑/etc/default/grub,增加GRUB_CMDLINE_LINUX="intel_pstate=disable idle=poll"
或者 Gedit /etc/default/grub,增加cmdline
4. 利用stress-ng,它是Linux系统下的系统压力测试工具,可位于stress-ng 0.17.05 - Download, Browsing & More | Fossies Archive 下载安装,给CPU加压:
stress-ng -c 核数 --timeout 秒数
5. 利用turbostat 查看CPU状态:
turbostat -i 1