How to get CPU usage from a Task Manager Window
Keywords: CPU usage Task Manager Process Information Extender
Question:
How can I get CPU usage from a task manager windowAnswer:
Look in the Process Information Extender help file, at the function tBrowseCntrs. This function will launch perfmon.exe, and you can select which process you want to monitor.For CPU Usage, select, "% Processor Time", and hit the OK button. Then in the following script, you'll see that tGetData returns the total CPU time, either as an integer value or as a floating point number.
AddExtender("wproc34I.dll") counterstring=tBrowseCntrs (0,0,0,0,0) Message("tBrowseCntrs returned full counter path",counterstring) if WinVersion(4)==4; NT intdat=tGetData(counterstring,0) fltdat=tGetData(counterstring,1) Message("tGetData for %counterstring%",strcat("Float Value:",fltdat,@CRLF,"Int Value: ",intdat)) endif
Article ID: W14547Filename: Get CPU Usage.txt