parent
38013b8e6d
commit
cbce4940aa
|
@ -84,6 +84,11 @@ public class ProcessInfo {
|
|||
return this.owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Memory information.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public static class MemoryInfo {
|
||||
|
||||
private static final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
|
||||
|
|
|
@ -37,7 +37,11 @@ class ProcessInfoTests {
|
|||
assertThat(processInfo.getPid()).isEqualTo(ProcessHandle.current().pid());
|
||||
assertThat(processInfo.getParentPid())
|
||||
.isEqualTo(ProcessHandle.current().parent().map(ProcessHandle::pid).orElse(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void memoryInfoIsAvailable() {
|
||||
ProcessInfo processInfo = new ProcessInfo();
|
||||
MemoryUsageInfo heapUsageInfo = processInfo.getMemory().getHeap();
|
||||
MemoryUsageInfo nonHeapUsageInfo = processInfo.getMemory().getNonHeap();
|
||||
assertThat(heapUsageInfo.getInit()).isPositive().isLessThanOrEqualTo(heapUsageInfo.getMax());
|
||||
|
|
Loading…
Reference in New Issue