Tracking CPU and Memory usage per process

前端 未结 16 2136
粉色の甜心
粉色の甜心 2020-11-28 01:28

I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn\'t help me as

16条回答
  •  伪装坚强ぢ
    2020-11-28 01:57

    maybe you can use this. It should work for you and will report processor time for the specified process.

    @echo off
    : Rich Kreider 
    : report processor time for given process until process exits (could be expanded to use a PID to be more
    : precise)
    : Depends:  typeperf
    : Usage:  foo.cmd 
    
    set process=%~1
    echo Press CTRL-C To Stop...
    :begin
    for /f "tokens=2 delims=," %%c in ('typeperf "\Process(%process%)\%% Processor Time" -si 1 -sc 1 ^| find /V "\\"') do (
    if %%~c==-1 (
    goto :end
    ) else (
    echo %%~c%%
    goto begin
    )
    )
    
    :end
    echo Process seems to have terminated.
    

提交回复
热议问题