Class FreeBsdGlobalMemory
java.lang.Object
oshi.hardware.common.AbstractGlobalMemory
oshi.hardware.common.platform.unix.freebsd.FreeBsdGlobalMemory
- All Implemented Interfaces:
GlobalMemory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract VirtualMemoryConstructs the matching FreeBsdVirtualMemory concrete (JNA or FFM) for this instance.longThe amount of physical memory currently available, in bytes.longThe number of bytes in a memory pagelonggetTotal()The amount of actual physical memory, in bytes.Virtual memory, such as a swap file.protected abstract longReadshw.physmemvia the subclass's sysctl mechanism.protected abstract longComputes available memory from FreeBSD's vm.stats.vm.v_inactive_count + v_free_count, multiplied by page size.Methods inherited from class AbstractGlobalMemory
getPhysicalMemory, toString
-
Constructor Details
-
FreeBsdGlobalMemory
public FreeBsdGlobalMemory()
-
-
Method Details
-
getAvailable
public long getAvailable()Description copied from interface:GlobalMemoryThe amount of physical memory currently available, in bytes.- Returns:
- Available number of bytes.
-
getTotal
public long getTotal()Description copied from interface:GlobalMemoryThe amount of actual physical memory, in bytes.- Returns:
- Total number of bytes.
-
getPageSize
public long getPageSize()Description copied from interface:GlobalMemoryThe number of bytes in a memory page- Returns:
- Page size in bytes.
-
getVirtualMemory
Description copied from interface:GlobalMemoryVirtual memory, such as a swap file.Operating systems differ significantly in how they manage virtual memory. See the
VirtualMemoryclass documentation for details on Windows commit-charge, Linux overcommit, and macOS compressed-memory models.- Returns:
- A VirtualMemory object.
-
queryVmStats
protected abstract long queryVmStats()Computes available memory from FreeBSD's vm.stats.vm.v_inactive_count + v_free_count, multiplied by page size. Subclasses provide the sysctl read mechanism (JNA via BsdSysctlUtil, FFM via direct sysctlbyname binding).- Returns:
- available memory in bytes
-
queryPhysMem
protected abstract long queryPhysMem()Readshw.physmemvia the subclass's sysctl mechanism.- Returns:
- total installed physical memory in bytes
-
createVirtualMemory
Constructs the matching FreeBsdVirtualMemory concrete (JNA or FFM) for this instance.- Returns:
- the VirtualMemory paired with this GlobalMemory implementation
-