:1.647KB : :1 :2021-01-13 17:19:45
lngResult = NtQuerySystemInformation_sti (#SYSTEM_TIME_INFORMATION, sti, 32, 0)
.如果真 (lngResult ≠ 0)
返回 (-1)
.如果真结束
lngResult = NtQuerySystemInformation_spi (#SYSTEM_PERFORMANCE_INFORMATION, spi, 312, 0)
.如果真 (lngResult ≠ 0)
返回 (-1)
.如果真结束
curIdle = spi.liIdleTime - lidOldIdle
curSystem = sti.liKeSystemTime - liOldSystem
.如果真 (curSystem ≠ 0)
lngResult = curIdle ÷ curSystem
.如果真结束
lngResult = 100 - lngResult × 100 ÷ 到数值 (读环境变量 (“NUMBER_OF_PROCESSORS”))
lidOldIdle = spi.liIdleTime
liOldSystem = sti.liKeSystemTime
返回 (lngResult)
01-17取进程CPU占用率
12-21取CPU占用率例子
12-13通过进程ID获取CPU占用率软件