pulling.availability_predection
Class CPU_Usage
java.lang.Object
pulling.availability_predection.CPU_Usage
- All Implemented Interfaces:
- java.io.Serializable
public class CPU_Usage
- extends java.lang.Object
- implements java.io.Serializable
This class represents the concept of system usage
in terms of CPU. It is used to read the CPU usage.
- Version:
- 1
- Author:
- Majd Kokaly
- See Also:
- Serialized Form
Constructor Summary |
CPU_Usage()
This constructor execute the sar command and set the usersPercentage, systemPercentage and the idlePercentage accordingly. |
CPU_Usage(int seconds,
int times)
This constructor execute the sar command with seconds and times argument passed to it and then set the usersPercentage, systemPercentage and the idlePercentage accordingly. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CPU_Usage
public CPU_Usage()
throws java.lang.Exception
- This constructor execute the sar command and set the usersPercentage, systemPercentage and the idlePercentage accordingly.
- Throws:
java.lang.Exception
- When the command sar is not properly executed.
CPU_Usage
public CPU_Usage(int seconds,
int times)
throws java.lang.Exception
- This constructor execute the sar command with seconds and times argument passed to it and then set the usersPercentage, systemPercentage and the idlePercentage accordingly.
- Throws:
java.lang.Exception
- When the command sar is not properly executed.
getUsersPercentage
public int getUsersPercentage()
setUsersPercentage
public void setUsersPercentage(int usersPercentage)
getSystemPercentage
public int getSystemPercentage()
setSystemPercentage
public void setSystemPercentage(int systemPercentage)
getIdlePercentage
public int getIdlePercentage()
setIdlePercentage
public void setIdlePercentage(int idlePercentage)
print
public void print()
getSystemIdlePercentage
public static int getSystemIdlePercentage()
- Returns:
- the current system idle percentage
getSystemIdlePercentage
public static int getSystemIdlePercentage(int seconds,
int times)
- Parameters:
seconds
- times
-
- Returns:
- the current system idle percentage after passing times and seconds to sar command