Package io.antmedia
Class SystemUtils
java.lang.Object
io.antmedia.SystemUtils
This utility is designed for accessing server's
system information more easier.
- Author:
- The Red5 Project ([email protected]), DZS|All-In-One ([email protected])
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Booleanstatic final Stringprivate static final Stringprivate static HotSpotDiagnosticMXBeanstatic final StringObtain Java JRE version.static final intprotected static final org.slf4j.Loggerstatic final intstatic final longstatic final Stringstatic final intstatic final StringObtain Operating System's Architecture.static final StringObtain Operating System's name.static final intObtain Operating System's processor.static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longstatic longconvertByteSize(long bytes, String size) static StringconvertByteSize(Long bytes, String size, boolean txtByte) Requirement support for...static StringconvertByteSize(Long bytes, String size, Boolean txtByte, boolean isDisk) Permit to convert bytes to ALMOST any upper bytes with/without extension (Currently at existing TeraByte but one step ahead, PetaByte)static StringconvertByteSizeToDisk(Long bytes, String size, boolean txtByte) protected static voidCustom Error issued switch.protected static voidError Exception issued switch.static voidgetHeapDump(String filepath) private static HotSpotDiagnosticMXBeanstatic Longstatic Longstatic IntegerReturns the "% recent cpu usage" for the Java Virtual Machine process.static LongReturns the CPU time used by the process on which the Java virtual machine is running in microseconds.static IntegerReturns the "% recent cpu usage" for the whole system.static doublestatic longstatic booleanstatic longObtain JVM's Free Memory.static longObtain JVM's In Use Memory.static longObtain JVM's Maximum Memory.static longObtain JVM's Total Memory.static longstatic longObtain Virtual Memory from Operating System's RAM.static longObtain Free Physical Memory from Operating System's RAM.static longObtain Free Swap Space from Operating System's RAM.static longosHDFreeSpace(String path) Obtain Harddrive's Available Space.static longosHDInUseSpace(String path) Obtain Harddrive's In Use Space.static longosHDTotalSpace(String path) Obtain Harddrive's Overall Space.static longosHDUsableSpace(String path) Obtain Harddrive's Usable Space.static longObtain In Use Physical Memory from Operating System's RAM.static longObtain In Use Swap Space from Operating System's RAM.static longObtain Total Physical Memory from Operating System's RAM.static longObtain Total Swap Space from Operating System's RAM.static StringreadCgroupFile(String filePath)
-
Field Details
-
HEAPDUMP_HPROF
- See Also:
-
MAX_CONTAINER_MEMORY_LIMIT_BYTES
public static final long MAX_CONTAINER_MEMORY_LIMIT_BYTES- See Also:
-
MAX_MEMORY_CGROUP_V2
- See Also:
-
osName
Obtain Operating System's name. -
osArch
Obtain Operating System's Architecture. -
jvmVersion
Obtain Java JRE version. -
osProcessorX
public static final int osProcessorXObtain Operating System's processor. -
HOTSPOT_BEAN_NAME
- See Also:
-
hotspotMBean
-
logger
protected static final org.slf4j.Logger logger -
MAC_OS_X
public static final int MAC_OS_X- See Also:
-
LINUX
public static final int LINUX- See Also:
-
WINDOWS
public static final int WINDOWS- See Also:
-
OS_TYPE
public static final int OS_TYPE -
containerized
-
-
Constructor Details
-
SystemUtils
public SystemUtils()
-
-
Method Details
-
jvmMaxMemory
public static long jvmMaxMemory()Obtain JVM's Maximum Memory.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
jvmTotalMemory
public static long jvmTotalMemory()Obtain JVM's Total Memory.- Returns:
- bytes size
-
jvmFreeMemory
public static long jvmFreeMemory()Obtain JVM's Free Memory.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
jvmInUseMemory
public static long jvmInUseMemory()Obtain JVM's In Use Memory.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osCommittedVirtualMemory
public static long osCommittedVirtualMemory()Obtain Virtual Memory from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osTotalPhysicalMemory
public static long osTotalPhysicalMemory()Obtain Total Physical Memory from Operating System's RAM.- Returns:
- bytes size
-
getTotalPhysicalMemorySize
public static long getTotalPhysicalMemorySize() -
osFreePhysicalMemory
public static long osFreePhysicalMemory()Obtain Free Physical Memory from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osAvailableMemory
public static long osAvailableMemory()- Returns:
- the amount of available physical memory
-
osInUsePhysicalMemory
public static long osInUsePhysicalMemory()Obtain In Use Physical Memory from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osTotalSwapSpace
public static long osTotalSwapSpace()Obtain Total Swap Space from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osFreeSwapSpace
public static long osFreeSwapSpace()Obtain Free Swap Space from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osInUseSwapSpace
public static long osInUseSwapSpace()Obtain In Use Swap Space from Operating System's RAM.- Parameters:
size- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osHDUsableSpace
Obtain Harddrive's Usable Space.- Parameters:
path- actual pathsize- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osHDTotalSpace
Obtain Harddrive's Overall Space.- Parameters:
path- actual pathsize- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osHDFreeSpace
Obtain Harddrive's Available Space.- Parameters:
path- actual pathsize- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
osHDInUseSpace
Obtain Harddrive's In Use Space.- Parameters:
path- actual pathsize- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
convertByteSize
Requirement support for... ------------------------------- jvmMaxMemory() jvmTotalMemory() jvmFreeMemory() jvmInUseMemory() osCommittedVirtualMemory() osFreePhysicalMemory() osTotalPhysicalMemory() osInUsePhysicalMemory() osFreeSwapSpace() osTotalSwapSpace() osInUseSwapSpace() osHDUsableSpace() osHDTotalSpace() osHDFreeSpace() osHDInUseSpace() ------------------------------- -
convertByteSizeToDisk
-
convertByteSize
-
convertByteSize
Permit to convert bytes to ALMOST any upper bytes with/without extension (Currently at existing TeraByte but one step ahead, PetaByte)- Parameters:
bytes- length of bytessize- null, AUTO, B, KB, MB, GB, TB, or PB (PetaByte does not exist yet) Is not case sensitive.txtByte- true if include byte extension, false exclude extension- Returns:
- bytes size
-
error
Error Exception issued switch.- Parameters:
e- Throws exception errors
-
error
Custom Error issued switch.- Parameters:
error- Error #info- Extra info from error executed
-
getSystemCpuLoad
Returns the "% recent cpu usage" for the whole system.- Returns:
-
getSystemLoadAverageLastMinute
public static double getSystemLoadAverageLastMinute() -
getProcessCpuLoad
Returns the "% recent cpu usage" for the Java Virtual Machine process. the method returns a negative value.- Returns:
-
getProcessCpuTime
Returns the CPU time used by the process on which the Java virtual machine is running in microseconds.- Returns:
-
getHeapDump
-
getHotspotMBean
-
availablePhysicalBytes
public static long availablePhysicalBytes() -
isContainerized
public static boolean isContainerized() -
getMemoryLimitFromCgroup
- Throws:
IOException
-
getMemAvailableFromCgroup
- Throws:
IOException
-
readCgroupFile
- Throws:
IOException
-