Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Getting physical CPU usage in Java?

Reply
Thread Tools

Getting physical CPU usage in Java?

 
 
nooneinparticular314159@yahoo.com
Guest
Posts: n/a
 
      07-15-2009
I'd like to be able to determine what the total CPU usage is on a
system using a Java program. (for those of you familiar with the Unix
program Top, it's the same idea. I want to be able to poll the system
to see how much CPU time is being used right now.)

Is there an easy way to do this? Is the method platform
indepdendent? ie. Since Java can run on any platform, will the
solution also work on any platform?

Thanks!
 
Reply With Quote
 
 
 
 
nooneinparticular314159
Guest
Posts: n/a
 
      07-15-2009
Oops...sorry about the duplicate posting. It didn't look like it had
gone through the first time...
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      07-15-2009
nooneinparticular314159 wrote:
> Oops...sorry about the duplicate posting. It didn't look like it had
> gone through the first time...


Don't use Google Groups.

If you must use GG, don't use refresh after you post, use one of the links.

--
Lew
 
Reply With Quote
 
nooneinparticular314159
Guest
Posts: n/a
 
      07-15-2009
Ok, but how do I measure CPU usage?

> Don't use Google Groups.
>
> If you must use GG, don't use refresh after you post, use one of the links.
>
> --
> Lew


 
Reply With Quote
 
Martin Demberger
Guest
Posts: n/a
 
      07-15-2009
Am Wed, 15 Jul 2009 09:21:52 +0100 schrieb bugbear:

> nooneinparticular314159 wrote:
>> Ok, but how do I measure CPU usage?

>
> I use top
>
> (Although, on a modern, multi-core, multi cpu system,
> CPU usage is nowhere near the simple concept it used to be)
>
> In truth, given that Java is designed to be
> system-blind, it would seem that the level
> of access required for what you want is almost
> a direct contradiction of Java's design goals.
>
> BugBear


Hi BugBear,
you can use the ThreadMXBean. For an example see
http://www.javaspecialists.eu/archive/Issue135.html

cu
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
32 bit Application physical memory usage under WOW64 Michael Windows 64bit 2 08-14-2009 10:28 PM
Getting physical CPU usage in Java? nooneinparticular314159@yahoo.com Java 9 07-20-2009 10:35 PM
retrieving CPU Usage and Memory Usage information in JAVA hvt Java 0 03-13-2007 01:09 PM
retrieving CPU Usage and Memory Usage information in JAVA hvt Java 0 03-13-2007 01:07 PM
Native VLAN - usage on multiply physical interfaces? DaZZa Cisco 0 04-12-2005 01:26 AM



Advertisments