- java.lang.Object
-
- com.ibm.lang.management.MemoryUsage
-
public class MemoryUsage extends Object
This represents a snapshot of the Operating System level Memory usage statistics. This is available on AIX, Linux, Windows and z/OS.- Since:
- 1.7.1
-
-
Constructor Summary
Constructors Constructor Description MemoryUsage()
Creates a newMemoryUsage
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MemoryUsage
from(CompositeData cd)
Receives aCompositeData
representing aMemoryUsage
long
getBuffered()
The amount of buffered memory in bytes.long
getCached()
The amount of cached memory in bytes.long
getFree()
The total amount of free physical memory in bytes.long
getSwapFree()
The amount of free swap space in bytes.long
getSwapTotal()
The amount of total swap space in bytes.long
getTimestamp()
The timestamp when the usage statistics were last sampled in microseconds.long
getTotal()
The total amount of usable physical memory in bytes.String
toString()
Text description of thisMemoryUsage
object.
-
-
-
Constructor Detail
-
MemoryUsage
public MemoryUsage()
Creates a newMemoryUsage
instance.
-
-
Method Detail
-
getTotal
public long getTotal()
The total amount of usable physical memory in bytes.- Returns:
- Total physical memory in bytes or -1 if info not available.
-
getFree
public long getFree()
The total amount of free physical memory in bytes.- Returns:
- Free physical memory in bytes or -1 if info not available.
-
getSwapTotal
public long getSwapTotal()
The amount of total swap space in bytes.- Returns:
- Total swap space in bytes or -1 if info not available.
-
getSwapFree
public long getSwapFree()
The amount of free swap space in bytes.- Returns:
- Free swap space in bytes or -1 if info not available.
-
getCached
public long getCached()
The amount of cached memory in bytes. Cached memory usually consists of contents of files and block devices.- Returns:
- Cached memory in bytes or -1 if info not available.
-
getBuffered
public long getBuffered()
The amount of buffered memory in bytes. Buffered memory usually consists of file metadata.- Buffered memory is not available on AIX and Windows.
- Returns:
- Buffered memory in bytes or -1 if info not available.
-
getTimestamp
public long getTimestamp()
The timestamp when the usage statistics were last sampled in microseconds.- Returns:
- Timestamp in microseconds.
-
from
public static MemoryUsage from(CompositeData cd)
Receives aCompositeData
representing aMemoryUsage
- Parameters:
cd
- ACompositeData
that represents aMemoryUsage
- Returns:
- If
cd
is non-null
, returns a new instance ofMemoryUsage
, Ifcd
isnull
, returnsnull
. - Throws:
IllegalArgumentException
- if argumentcd
does not correspond to aMemoryUsage
with the following attributes:total
(java.lang.Long
)free
(java.lang.Long
)swapTotal
(java.lang.Long
)swapFree
(java.lang.Long
)cached
(java.lang.Long
)buffered
(java.lang.Long
)timestamp
(java.lang.Long
)
-
toString
public String toString()
Text description of thisMemoryUsage
object.- Overrides:
toString
in classObject
- Returns:
- a text description of this
MemoryUsage
object.
-
-