Package oshi.hardware.platform.mac
Class MacGlobalMemory
- java.lang.Object
-
- oshi.hardware.common.AbstractGlobalMemory
-
- oshi.hardware.platform.mac.MacGlobalMemory
-
- All Implemented Interfaces:
GlobalMemory
@ThreadSafe final class MacGlobalMemory extends AbstractGlobalMemory
Memory obtained by host_statistics (vm_stat) and sysctl.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<java.lang.Long>
available
private static org.slf4j.Logger
LOG
private java.util.function.Supplier<java.lang.Long>
pageSize
private java.util.function.Supplier<java.lang.Long>
total
private java.util.function.Supplier<VirtualMemory>
vm
-
Constructor Summary
Constructors Constructor Description MacGlobalMemory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private VirtualMemory
createVirtualMemory()
long
getAvailable()
The amount of physical memory currently available, in bytes.long
getPageSize()
The number of bytes in a memory pagejava.util.List<PhysicalMemory>
getPhysicalMemory()
Physical memory, such as banks of memory.long
getTotal()
The amount of actual physical memory, in bytes.VirtualMemory
getVirtualMemory()
Virtual memory, such as a swap file.private static long
queryPageSize()
private static long
queryPhysMem()
private long
queryVmStats()
-
Methods inherited from class oshi.hardware.common.AbstractGlobalMemory
toString
-
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
available
private final java.util.function.Supplier<java.lang.Long> available
-
total
private final java.util.function.Supplier<java.lang.Long> total
-
pageSize
private final java.util.function.Supplier<java.lang.Long> pageSize
-
vm
private final java.util.function.Supplier<VirtualMemory> vm
-
-
Method Detail
-
getAvailable
public long getAvailable()
Description copied from interface:GlobalMemory
The amount of physical memory currently available, in bytes.- Returns:
- Available number of bytes.
-
getTotal
public long getTotal()
Description copied from interface:GlobalMemory
The amount of actual physical memory, in bytes.- Returns:
- Total number of bytes.
-
getPageSize
public long getPageSize()
Description copied from interface:GlobalMemory
The number of bytes in a memory page- Returns:
- Page size in bytes.
-
getVirtualMemory
public VirtualMemory getVirtualMemory()
Description copied from interface:GlobalMemory
Virtual memory, such as a swap file.- Returns:
- A VirtualMemory object.
-
getPhysicalMemory
public java.util.List<PhysicalMemory> getPhysicalMemory()
Description copied from interface:GlobalMemory
Physical memory, such as banks of memory.On Linux, requires elevated permissions. On FreeBSD and Solaris, requires installation of dmidecode.
- Specified by:
getPhysicalMemory
in interfaceGlobalMemory
- Overrides:
getPhysicalMemory
in classAbstractGlobalMemory
- Returns:
- A list of PhysicalMemory objects.
-
queryVmStats
private long queryVmStats()
-
queryPhysMem
private static long queryPhysMem()
-
queryPageSize
private static long queryPageSize()
-
createVirtualMemory
private VirtualMemory createVirtualMemory()
-
-