sk.baka.webvm.analyzer
Class CpuUsage

java.lang.Object
  extended by sk.baka.webvm.analyzer.CpuUsage

public final class CpuUsage
extends Object

Provides a CPU measurement support.

Author:
Martin Vysny

Constructor Summary
CpuUsage(ICpuUsageMeasure usage)
          Creates a new CPU usage measurer.
 
Method Summary
 int getCpuUsage()
          Returns an average CPU usage in a time slice starting at the previous call of this method.
 boolean supported()
          Checks if this measurement is supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CpuUsage

public CpuUsage(ICpuUsageMeasure usage)
Creates a new CPU usage measurer.

Parameters:
usage - retrieve usage data from this object.
Method Detail

supported

public boolean supported()
Checks if this measurement is supported.

Returns:
true if supported, false if getCpuUsage() will always return -1.

getCpuUsage

public int getCpuUsage()
Returns an average CPU usage in a time slice starting at the previous call of this method.

Returns:
average overall CPU usage or -1 if CPU sampling is unsupported or error occurred.


Copyright © 2010 Baka. All Rights Reserved.