Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get CPU Utilization through Command Promt? 1

Status
Not open for further replies.

rohansr002

Programmer
Feb 19, 2010
15
IN
How to CPU utilization from command prompt. Does any 1 knows command that shows CPU utilization from cmd.
Please help.
Thnks in advance
 
Will Typeperf do it for you?

This command produces output in a Command Prompt but you have to manually stop the stream of output via a Ctrl + C key entry.

typeperf "\Memory\Available bytes" "\processor(_total)\% processor time"

The output that I saw looked like this -

"03/12/2010 04:54:44.420","2767368192.000000","13.845755"
"03/12/2010 04:54:45.434","2767294464.000000","11.538048"
"03/12/2010 04:54:46.448","2767220736.000000","10.768817"
"03/12/2010 04:54:47.462","2767261696.000000","8.461109"
"03/12/2010 04:54:48.476","2767450112.000000","13.845755"
"03/12/2010 04:54:49.490","2767458304.000000","10.768817"
"03/12/2010 04:54:50.504","2767454208.000000","14.614985"
"03/12/2010 04:54:51.518","2768117760.000000","4.614942"


I am assuming that the last figure in each line is the CPU usage but I could be wrong there?


Typeperf

Personally I cheat and just type Taskmgr at the prompt to bring up the Task Manager but obviously the output is GUI and not in the prompt.
 
Thnks for code, but the next question is how to get this code into a file, and how to invoke this command through Java Code?? I am doing load balancing on server hence i need it..please help
 
To get it into a file, use the PIPE command.

typeperf "\Memory\Available bytes" "\processor(_total)\% processor time" >> c:/path/myfile.txt

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top