Class CpuUsageResolver
java.lang.Object
eu.cloudnetservice.utils.base.resource.CpuUsageResolver
A utility class to resolve the usage of the host system CPU.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReads the process cpu usage for the current jvm process and converts the returned value into a percentage.Reads the current system cpu usage and converts the returned value into a percentage.
-
Field Details
-
OS_BEAN
-
-
Constructor Details
-
CpuUsageResolver
private CpuUsageResolver()
-
-
Method Details
-
systemCpuLoad
Reads the current system cpu usage and converts the returned value into a percentage. Note: in case that the value is not available, this method returns-1.- Returns:
- the current system cpu load formatted to a percentage or -1 if not available.
-
processCpuLoad
Reads the process cpu usage for the current jvm process and converts the returned value into a percentage. Note: in case that the value is not available, this method returns-1.- Returns:
- the current process cpu load formatted to a percentage or -1 if not available.
-