File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading values from Task manager

 
Neha Deshmukh
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to read CPU Usage percentage from task manager in a file.
Can anybody tell me can we do this and if yes how to do this?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take it you're running Windows. Some versions come with an executable called "typeperf", which can report CPU utilization. You can execute it using Runtime.exec or ProcessBuilder, and then parse the results.

Some other tools were mentioned in this thread, but I think none of those reports CPU percentages.
[ August 15, 2007: Message edited by: Ulf Dittmer ]
 
Neha Deshmukh
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you please tell me how to typeperf throght Runtime.exec.
I really don't know how to use Runtime.exec and typeperf so can you please help me in this matter?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An introduction to Runtime.exe can be found in this article.

Running typeperf shouldn't present a problem, if it's available.
 
Neha Deshmukh
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When I am trying to run typeperf through runtime.exec() it is giving error -
ejava.io.IOException: Cannot run program "typeperf": CreateProcess error=2, The
system cannot find the file specified.
I guess typeperf is not available on machine so can you suggest how to download or use it?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the thread linked above mentions, it's not part of all Windows versions. Microsoft's web site would be a good place to get some information about it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic