public class ResourceUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
ResourceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Optional<Container> |
getContainerByHostname(List<Container> containers,
String hostName)
Get container by hostname
|
static Optional<Container> |
getContainerById(List<Container> containers,
ContainerId containerID)
Get container by id
|
static List<Container> |
getContainersByHostname(List<Container> containers,
Collection<String> containerHosts)
Get containers by hostname of address
|
static int |
getCpuCores() |
static long |
getJvmHeapUsageInBytes() |
static double |
getJvmHeapUsageRatio() |
static double |
getProcessCpuUsage() |
static double |
getSystemCpuUsage() |
static double |
getSystemCpuUtilByMXBean()
Returns the "recent cpu usage" for the whole system.
|
static double |
getSystemCpuUtilByVsar()
Get system cpu util by vsar
|
static double |
getSystemLoadAverage() |
static long |
getSystemMemoryUsage() |
static double |
getSystemMemoryUsageRatio() |
static long |
getSystemTotalMemory() |
static void |
logProcessMemoryDetail()
Log current jvm process's memory detail
|
public static void logProcessMemoryDetail()
public static double getJvmHeapUsageRatio()
public static long getJvmHeapUsageInBytes()
public static long getSystemTotalMemory()
public static long getSystemMemoryUsage()
public static double getSystemMemoryUsageRatio()
public static double getProcessCpuUsage()
public static double getSystemCpuUsage()
public static double getSystemCpuUtilByMXBean()
public static double getSystemCpuUtilByVsar()
throws Exception
Exceptionpublic static double getSystemLoadAverage()
public static int getCpuCores()
public static List<Container> getContainersByHostname(List<Container> containers, Collection<String> containerHosts)
containers - container listcontainerHosts - container hostname or address setpublic static Optional<Container> getContainerByHostname(List<Container> containers, String hostName)
hostName - container hostnamepublic static Optional<Container> getContainerById(List<Container> containers, ContainerId containerID)
containerID - container idCopyright © 2021. All rights reserved.