Skip to main content
formatting
Source Link
Chin
  • 20.9k
  • 38
  • 113
  • 173

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean   = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage();   return load;  } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage();   return load;  } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

public static double getCPULoad() { OperatingSystemMXBean osMBean   = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage(); return load; } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage(); return load; } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

Thanks :)

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage(); return load; } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

Thanks :)

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage(); return load; } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

Source Link

Alternate of getSystemLoadAverage() for Windows?

I am working on with some code to monitor Cpu load using Java. I am using following code in my app to get system load

 public static double getCPULoad() { OperatingSystemMXBean osMBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); double load = osMBean.getSystemLoadAverage(); return load; } 

But on windows it returns me a negative value (-1.0). Is there any way i can solve this problem?

Thanks :)