总目录传送门

本博文技术等级:

获取cpu使用率:

CPU利用率使用两次采样时间信息, 然后计算其差值, 再计算占比得到.

windows:

可以通过系统api GetSystemTimes来获取
https://docs.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-getsystemtimes

BOOL GetSystemTimes(
  PFILETIME lpIdleTime, //空闲时间
  PFILETIME lpKernelTime, //核心态时间
  PFILETIME lpUserTime //用户态时间
);

cpu

本文地址:https://blog.csdn.net/zhengtianzuo06/article/details/112281759