Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to find-out CPU load ?

Reply
Thread Tools

How to find-out CPU load ?

 
 
Meir
Guest
Posts: n/a
 
      07-01-2003
Is there a way in Java to find-out the current CPU load ?

Are there any external packages for this ?

All I need is a single number in percents,
but I need a solution for Windows2K and UNIX.

Meir
 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      07-01-2003
In article < >, Meir wrote:
> Is there a way in Java to find-out the current CPU load ?
>
> Are there any external packages for this ?
>
> All I need is a single number in percents,
> but I need a solution for Windows2K and UNIX.
>
> Meir


First you must get the system paramter to find out what system you're on.
For each type of system load the right module: the kernel32.dll for
windows and nothing for unix/linux. I'm sure there is a call you could
make with the kernel32.dll to find the windows load average. For unix
exec /usr/bin/uptime and read/parse its output. For Linux you can
open and read /proc/cpuinfo until you find the load average.

Mike
 
Reply With Quote
 
 
 
 
S. Balk
Guest
Posts: n/a
 
      07-01-2003
> You could do it the same way Windows itself does run a task at the
> lowest priority and see how many cycles it manages to consume.


This would stress the CPU to 100%

What's the timespan for this counting (every second) to prevent it from
stressing the cpu to much?


 
Reply With Quote
 
S. Balk
Guest
Posts: n/a
 
      07-01-2003
> > You could do it the same way Windows itself does run a task at the
> > lowest priority and see how many cycles it manages to consume.

>
> This would stress the CPU to 100%
>
> What's the timespan for this counting (every second) to prevent it from
> stressing the cpu to much?


Another point, this won't give you a percentage, because you don't know how
much cycles you get when the cpu is *totally* idle


 
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
How CPU Features Affect CPU Performance Ian Front Page News 0 02-18-2010 03:28 PM
How , system cpu and user cpu times calculates pavunkumar C Programming 1 02-27-2009 08:29 AM
HELP! Trying to understand the logic behind CPU core speeds and whole CPU speed. dimon Computer Support 4 11-10-2006 04:01 PM
Pentium CPU vs Intel Celeron CPU and the Wireless Mouse kirk lives! Computer Support 4 05-02-2004 06:59 PM
CPU load of cisco3640 Sun Guonian Cisco 7 11-12-2003 04:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57