惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
WordPress大学
WordPress大学
IT之家
IT之家
G
Google Developers Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
V
V2EX
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
V
Visual Studio Blog
有赞技术团队
有赞技术团队
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网

kkocdko's blog

Tasker 永久试用修改思路 - kkocdko's blog 极限压缩文档扫描件 - kkocdko's blog Bypass the Blank Chars Detection crknob - Chrome portable patch 我如何将博客首页体积降至 3 KB - kkocdko's blog 如何极限优化压缩文件体积 - kkocdko's blog EmEditor 精简版 - kkocdko's blog Backup Data from VSCode Web 优雅地游玩 Minecraft - kkocdko's blog 让程序以管理员权限运行的 PE 清单 - kkocdko's blog 注销 ZEIT 账号之后遇到的坑 - kkocdko's blog 本博客的协议已更改为 CC0 - kkocdko's blog mobp - 使 MSOffice 后台常驻 在安装 VS 生成工具时规避 .NET 安装错误 各种格式的占位空文件 - kkocdko's blog 优雅地游玩 Flash 游戏 - kkocdko's blog WPS 2016 极限精简版 - kkocdko's blog Convert Const to Let by Terser 规避 Visual Studio 许可证过期的 Bug 方便地使用 iPod - kkocdko's blog 用 UserJS 注入 UserCSS - kkocdko's blog 注册表修改文件关联(默认程序) - kkocdko's blog 周期精准的太阳系模型 - kkocdko's blog 关闭屏幕的 WinAPI - kkocdko's blog 重置 Windows 图标缓存 - kkocdko's blog AIDA64 极限精简单文件版 - kkocdko's blog 几何画板单文件精简版 - kkocdko's blog 世界之窗浏览器单文件版 - kkocdko's blog 在 MBR + Legacy 下用 Bootmgr 引导 Ubuntu 简洁的 Markdown 预览工具 - kkocdko's blog
Tweak CPU Power Elegantly on Windows
2026-04-11 · via kkocdko's blog

KKOCDKO was watching movie on his laptop, but the fan system came into a start-stop cycle, which made him crazy: fan on > cooling > fan off > heating > fan on...

Go to "Control Panel > Power Options > Advanced Settings > Processor Power Management", set "Minimum processor state" to 0%(1), and the "Maximum processor state" is the point.

Set this value to 99%, you can disable the boosting. To 0%, make the frequency to lowest(2). But it is troublesome to change the value by hand every time, so:

Using powercfg

@echo off
echo   [1] High   [2] Medium   [3] Low
choice /c 123 >nul
if "%errorLevel%"=="1" set percent=100
if "%errorLevel%"=="2" set percent=99
if "%errorLevel%"=="3" set percent=0
powercfg /setacvalueindex SCHEME_BALANCED SUB_PROCESSOR PROCTHROTTLEMAX %percent%
powercfg /setdcvalueindex SCHEME_BALANCED SUB_PROCESSOR PROCTHROTTLEMAX %percent%
:: Make changes active
powercfg /s SCHEME_BALANCED
exit

(1) Parameter not showed? or Change Ineffective?

(2) Not the lowest, on my R5-5600U, its 1099 MHz.

But why not Linux? Try cpupower.

Using WinAPI

Refer to the descriptions on MSDN, we could find that there are some WinAPI which could modify the power config. So cpu-rate.cc:

#include <windows.h>

#include <powrprof.h>

int main(int argc, char *argv[]) {
  if (argc == 3)
    Sleep(atoi(argv[2]));
  DWORD percent = atoi(argv[1]);
  GUID guid, *scheme = &guid;
  PowerGetActiveScheme(NULL, &scheme);
  PowerWriteACValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP,
                         &GUID_PROCESSOR_THROTTLE_MAXIMUM, percent);
  PowerWriteDCValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP,
                         &GUID_PROCESSOR_THROTTLE_MAXIMUM, percent);
  PowerSetActiveScheme(NULL, scheme);
  return 0;
}

Seems much complex than powercfg cli tool? But it's fast! On my laptop, the powercfg took 200+ms to finish its process, but this one took only 19ms. This caused we could use this to modify our own CPU schedule policy. For example, I wrote a batch to compile my algorithm study project:

:: cpu-rate <percent> [delay]
start "" cpu-rate 100
clang++ src\main.cc -o build\main
start "" cpu-rate 0 1000
build\main

Now CPU runs on the maximum frequency only in compile. Without this, the default CPU schedule will jump to high frequency even if you move the cursor.

At this moment, I'm coding on our school library, battery usage in the previous 2 hours is only 14% :-)