用 typeperf 在终端里查看 CPU 占用
用 typeperf 性能计数器每隔几秒把整体 CPU 使用率输出到命令行窗口。
运行:typeperf "\Processor(_Total)\% Processor Time" -si 2(按 Ctrl+C 停止)
01命令
命令
$ typeperf "\Processor(_Total)\% Processor Time" -si 202作用说明
typeperf 可以读取 Windows 性能计数器并按间隔打印数值。\Processor(_Total)\% Processor Time 代表整体 CPU 负载,-si 2 表示每 2 秒采样一次。排查问题时它比打开任务管理器更轻量,按 Ctrl+C 即可停止。
03风险
!注意: 计数器名称与系统语言相关:非英文系统的计数器可能是本地化名称(或需要用数字 ID)。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- typeperf (Windows Commands)依据: Official reference: typeperf outputs performance counter data; the -si parameter sets the sample interval, and counter paths like \Processor(_Total)\% Processor Time are valid counters.
- TypePerf - Write performance counter data依据: Documents typeperf for writing performance counter data to the command window, with the -si option setting the sample interval (e.g. -si 2 = every 2 seconds).
最后验证: 2026-09-19 · 分类: 系统与设置