public class ResourceUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static org.slf4j.Logger |
LOG |
| 构造器和说明 |
|---|
ResourceUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
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()
Returns system cpu cores num
|
static long |
getJvmHeapUsageInBytes() |
static double |
getJvmHeapUsageRatio() |
static double |
getProcessCpuUsage()
Returns the cpu load for current jvm process.
|
static double |
getSystemCpuUsage() |
static double |
getSystemCpuUtilByMXBean() |
static double |
getSystemCpuUtilByVsar()
Get system cpu util by vsar
|
static double |
getSystemLoadAverage()
Returns the system load average for the last minute
|
static long |
getSystemMemoryUsage()
Returns the used system physical memory in bytes
|
static double |
getSystemMemoryUsageRatio()
Returns the ratio of used system physical memory.
|
static long |
getSystemTotalMemory()
Returns the total amount of physical memory in bytes.
|
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 © 2022. All rights reserved.