Add JvmInformation#getMemoryUsed method
This commit is contained in:
parent
d3b09848b6
commit
7d8d277bc1
1 changed files with 11 additions and 1 deletions
|
@ -120,7 +120,7 @@ public final class JvmInformation {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the total amount of memory used by the JVM and the running application.
|
||||
* Returns the total amount of memory used the running application AND JVM.
|
||||
* <p>
|
||||
* Note: This is an estimate.
|
||||
*
|
||||
|
@ -151,6 +151,16 @@ public final class JvmInformation {
|
|||
return Runtime.getRuntime().freeMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of memory used by the running application.
|
||||
*
|
||||
* @return amount of used memory
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
public static long getMemoryUsed() {
|
||||
return getMemoryMax() - getMemoryFree();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the memory usage of the heap.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue