IFEX D:\X.LOG, LOGS * D:\X.LOG
ENVI^ forcelocal=1
ENVI &CPUS=1  //CPU个数
FIND  --pid  &TMS,
MSTR  &I1=<1>%&TMS%
MSTR  &T1=<2>%&TMS%
MSTR  &CPUS=<3>%&TMS%  //CPU个数
SET &Last=-100
//FIND  --pid*@0  &TMSS,
//MESS %&TMS% \n%&TMSS%  //所有进程
//MESS [%&CPUS%]
WAIT 250
CALL WIN1
_SUB WIN1,W285H129,CPU,
    LABE ,L44T19W60H25,CPU,,
    LABE CPU,L133T20W60H25,,,
    PBAR PBCPU,L44T47W149H14,0
    TIME Timer1,500, CALL OnTimer1
    CALL OnTimer1 
_END // 

_SUB OnTimer1
    FIND  --pid  &TMS,
    MSTR  &I2=<1>%&TMS%
    MSTR  &T2=<2>%&TMS%
    CALC #&I21=%&I2% - %&I1%
    CALC #&T21=%&T2% - %&T1%
    CALC &P= 100 - 100 * %&I21% / %&T21% / %&CPUS% ##1
    FIND $%P%=-0.0, SET P=0
    IFEX $%P%<0, EXIT
    IFEX $%Last%=%P%, EXIT 
    SET Last=%P%
    //IFEX $%P%<0, SET P=0
    //CALC &N= %&P% + 0 #0
    //IFEX $%&N%<0, SET N=0
    //ENVI @CPU=%&P%%%
    ENVI @PBCPU=%&P%;%&P%%%
    ENVI &I1=%&I2%
    ENVI &T1=%&T2%
_END

@EXEC $D:\X.LOG
