Package oshi.hardware.platform.linux
Class LinuxGlobalMemory
- java.lang.Object
-
- oshi.hardware.common.AbstractGlobalMemory
-
- oshi.hardware.platform.linux.LinuxGlobalMemory
-
- All Implemented Interfaces:
java.io.Serializable
,GlobalMemory
public class LinuxGlobalMemory extends AbstractGlobalMemory
Memory obtained by /proc/meminfo and sysinfo.totalram- Author:
- alessandro[at]perucchi[dot]org, widdis[at]gmail[dot]com
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class oshi.hardware.common.AbstractGlobalMemory
memAvailable, memTotal, pageSize, swapPagesIn, swapPagesOut, swapTotal, swapUsed
-
-
Constructor Summary
Constructors Constructor Description LinuxGlobalMemory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
updateMeminfo()
Updates instance variables from reading /proc/meminfo no more frequently than every 100ms.protected void
updateSwap()
Updates virtual memory instance variables.-
Methods inherited from class oshi.hardware.common.AbstractGlobalMemory
getAvailable, getPageSize, getSwapPagesIn, getSwapPagesOut, getSwapTotal, getSwapUsed, getTotal
-
-
-
-
Method Detail
-
updateMeminfo
protected void updateMeminfo()
Updates instance variables from reading /proc/meminfo no more frequently than every 100ms. While most of the information is available in the sysinfo structure, the most accurate calculation of MemAvailable is only available from reading this pseudo-file. The maintainers of the Linux Kernel have indicated this location will be kept up to date if the calculation changes: see https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/? id=34e431b0ae398fc54ea69ff85ec700722c9da773 Internally, reading /proc/meminfo is faster than sysinfo because it only spends time populating the memory components of the sysinfo structure.- Specified by:
updateMeminfo
in classAbstractGlobalMemory
-
updateSwap
protected void updateSwap()
Updates virtual memory instance variables.- Specified by:
updateSwap
in classAbstractGlobalMemory
-
-