public class LinuxInfoUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LinuxInfoUtils.NICUnit |
static class |
LinuxInfoUtils.NICUsageType |
static class |
LinuxInfoUtils.ResourceUsage |
static class |
LinuxInfoUtils.UsageUnit |
| Constructor and Description |
|---|
LinuxInfoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkHasNicSpeeds()
Check this VM has nic speed.
|
static double |
getCpuUsageForCGroup()
Get CGroup cpu usage.
|
static LinuxInfoUtils.ResourceUsage |
getCpuUsageForEntireHost()
Reads first line of /proc/stat to get total cpu usage.
|
static List<String> |
getPhysicalNICs()
Get all physical nic path.
|
static double |
getTotalCpuLimit(boolean isCGroupsEnabled)
Get total cpu limit.
|
static double |
getTotalNicLimit(List<String> nics,
LinuxInfoUtils.NICUnit nicUnit)
Get all physical nic limit.
|
static double |
getTotalNicUsage(List<String> nics,
LinuxInfoUtils.NICUsageType type,
LinuxInfoUtils.UsageUnit unit)
Get all physical nic usage.
|
static boolean |
isCGroupEnabled()
Determine whether the OS enable CG Group.
|
static boolean |
isLinux()
Determine whether the OS is the linux kernel.
|
public static boolean isLinux()
public static boolean isCGroupEnabled()
public static double getTotalCpuLimit(boolean isCGroupsEnabled)
isCGroupsEnabled - Whether CGroup is enabledpublic static double getCpuUsageForCGroup()
public static LinuxInfoUtils.ResourceUsage getCpuUsageForEntireHost()
cpu user nice system idle iowait irq softirq steal guest guest_nice
cpu 317808 128 58637 2503692 7634 0 13472 0 0 0
Line is split in "words", filtering the first. The sum of all numbers give the amount of cpu cycles used this far. Real CPU usage should equal the sum substracting the idle cycles, this would include iowait, irq and steal.
public static double getTotalNicLimit(List<String> nics, LinuxInfoUtils.NICUnit nicUnit)
nics - All nic pathnicUnit - Nic speed unitpublic static double getTotalNicUsage(List<String> nics, LinuxInfoUtils.NICUsageType type, LinuxInfoUtils.UsageUnit unit)
nics - All nic pathtype - Nic's usage type: transport, receiveunit - Nic usage unitpublic static List<String> getPhysicalNICs()
public static boolean checkHasNicSpeeds()
Copyright © 2017–2022 Apache Software Foundation. All rights reserved.