Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Please check this code for CPU utilization

Please check this code for CPU utilization

Please check this code for CPU utilization

I am working on this code for CPU Utilization, i am getting output as "0.0", for including the class file u need to Add .jar file, which is at Url "http://github.com/jezhumble/javasysmon/downloads".....download JavaSysMon 0.3.0 from this url and to Library.

The code is as follows:

import com.jezhumble.javasysmon.*;
public class CpuUtilize {

     * @param args
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        JavaSysMon obj1= new JavaSysMon();
            long p1=obj1.cpuTimes().getUserMillis();
            long p2=obj1.cpuTimes().getSystemMillis();
            long p3=obj1.cpuTimes().getIdleMillis();
            CpuTimes previous=new CpuTimes(p1,p2,p3);
            //JavaSysMon obj1= new JavaSysMon();
            Float tr1= obj1.cpuTimes().getCpuUsage(previous);
            System.out.println("The Cpu Utiliztion Value: "+tr1);



1. I am unable to understand how to get CPU Utilization from this code, as it is giving "0.0" output.

please Help as soon as possible.

RE: Please check this code for CPU utilization

Some hints:

- Use the Java forum, this one is for J2EE questions.
- Post the relevant parts of code. You will get more answers that way


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close