Record Class ProcessSnapshot
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.service.ProcessSnapshot
- Record Components:
pid- the process id of the component which created the snapshot.cpuUsage- the recent usage of the cpu usage associated with the component process.systemCpuUsage- the recent usage of the hosts' system cpu the process is running on.maxHeapMemory- the maximum heap memory space the associated process is allowed to use.heapUsageMemory- the heap memory of all pools which the associated process is currently using.noHeapUsageMemory- the off-heap memory of all pools which the associated process is currently using.unloadedClassCount- the amount of classes the associated process unloaded since starting.totalLoadedClassCount- the amount of classes which were loaded since the associated process was started.currentLoadedClassCount- the amount of classes which are currently loaded by the associated process.threads- a snapshot of all threads which are currently known to the associated process.
- All Implemented Interfaces:
Cloneable
public record ProcessSnapshot(long pid, double cpuUsage, double systemCpuUsage, long maxHeapMemory, long heapUsageMemory, long noHeapUsageMemory, long unloadedClassCount, long totalLoadedClassCount, int currentLoadedClassCount, @NonNull Collection<ThreadSnapshot> threads)
extends Record
implements Cloneable
A snapshot of the process resources at a specific time. It holds the most useful information for displaying or
storing statistics about a service / node (or anything else).
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ClassLoadingMXBeanprivate final doubleThe field for thecpuUsagerecord component.private final intThe field for thecurrentLoadedClassCountrecord component.private static final ProcessSnapshotprivate final longThe field for theheapUsageMemoryrecord component.private final longThe field for themaxHeapMemoryrecord component.private static final MemoryMXBeanprivate final longThe field for thenoHeapUsageMemoryrecord component.private static final OperatingSystemMXBeanprivate static final longprivate final longThe field for thepidrecord component.private final doubleThe field for thesystemCpuUsagerecord component.private static final ThreadMXBeanprivate final @NonNull Collection<ThreadSnapshot> The field for thethreadsrecord component.private final longThe field for thetotalLoadedClassCountrecord component.private final longThe field for theunloadedClassCountrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionProcessSnapshot(long pid, double cpuUsage, double systemCpuUsage, long maxHeapMemory, long heapUsageMemory, long noHeapUsageMemory, long unloadedClassCount, long totalLoadedClassCount, int currentLoadedClassCount, @NonNull Collection<ThreadSnapshot> threads) Creates an instance of aProcessSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionclone()doublecpuUsage()Returns the value of thecpuUsagerecord component.intReturns the value of thecurrentLoadedClassCountrecord component.static @NonNull ProcessSnapshotempty()Get a jvm static process snapshot which holds no information about any process.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of theheapUsageMemoryrecord component.longReturns the value of themaxHeapMemoryrecord component.longReturns the value of thenoHeapUsageMemoryrecord component.static longownPID()Gets the jvm static, one-time initialized id of the current process.longpid()Returns the value of thepidrecord component.static @NonNull ProcessSnapshotself()Creates a new process snapshot info filled with information about the current process.doubleReturns the value of thesystemCpuUsagerecord component.threads()Returns the value of thethreadsrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalLoadedClassCountrecord component.longReturns the value of theunloadedClassCountrecord component.
-
Field Details
-
pid
private final long pidThe field for thepidrecord component. -
cpuUsage
private final double cpuUsageThe field for thecpuUsagerecord component. -
systemCpuUsage
private final double systemCpuUsageThe field for thesystemCpuUsagerecord component. -
maxHeapMemory
private final long maxHeapMemoryThe field for themaxHeapMemoryrecord component. -
heapUsageMemory
private final long heapUsageMemoryThe field for theheapUsageMemoryrecord component. -
noHeapUsageMemory
private final long noHeapUsageMemoryThe field for thenoHeapUsageMemoryrecord component. -
unloadedClassCount
private final long unloadedClassCountThe field for theunloadedClassCountrecord component. -
totalLoadedClassCount
private final long totalLoadedClassCountThe field for thetotalLoadedClassCountrecord component. -
currentLoadedClassCount
private final int currentLoadedClassCountThe field for thecurrentLoadedClassCountrecord component. -
threads
The field for thethreadsrecord component. -
MEMORY_MX_BEAN
-
THREAD_MX_BEAN
-
CLASS_LOADING_MX_BEAN
-
OS_BEAN
-
OWN_PID
private static final long OWN_PID -
EMPTY
-
-
Constructor Details
-
ProcessSnapshot
public ProcessSnapshot(long pid, double cpuUsage, double systemCpuUsage, long maxHeapMemory, long heapUsageMemory, long noHeapUsageMemory, long unloadedClassCount, long totalLoadedClassCount, int currentLoadedClassCount, @NonNull @NonNull Collection<ThreadSnapshot> threads) Creates an instance of aProcessSnapshotrecord class.- Parameters:
pid- the value for thepidrecord componentcpuUsage- the value for thecpuUsagerecord componentsystemCpuUsage- the value for thesystemCpuUsagerecord componentmaxHeapMemory- the value for themaxHeapMemoryrecord componentheapUsageMemory- the value for theheapUsageMemoryrecord componentnoHeapUsageMemory- the value for thenoHeapUsageMemoryrecord componentunloadedClassCount- the value for theunloadedClassCountrecord componenttotalLoadedClassCount- the value for thetotalLoadedClassCountrecord componentcurrentLoadedClassCount- the value for thecurrentLoadedClassCountrecord componentthreads- the value for thethreadsrecord component
-
-
Method Details
-
empty
Get a jvm static process snapshot which holds no information about any process.- Returns:
- an empty static process snapshot.
-
self
Creates a new process snapshot info filled with information about the current process.- Returns:
- a process snapshot holding information about the current process.
-
ownPID
public static long ownPID()Gets the jvm static, one-time initialized id of the current process.- Returns:
- the current process id.
-
clone
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
pid
-
cpuUsage
-
systemCpuUsage
public double systemCpuUsage()Returns the value of thesystemCpuUsagerecord component.- Returns:
- the value of the
systemCpuUsagerecord component
-
maxHeapMemory
public long maxHeapMemory()Returns the value of themaxHeapMemoryrecord component.- Returns:
- the value of the
maxHeapMemoryrecord component
-
heapUsageMemory
public long heapUsageMemory()Returns the value of theheapUsageMemoryrecord component.- Returns:
- the value of the
heapUsageMemoryrecord component
-
noHeapUsageMemory
public long noHeapUsageMemory()Returns the value of thenoHeapUsageMemoryrecord component.- Returns:
- the value of the
noHeapUsageMemoryrecord component
-
unloadedClassCount
public long unloadedClassCount()Returns the value of theunloadedClassCountrecord component.- Returns:
- the value of the
unloadedClassCountrecord component
-
totalLoadedClassCount
public long totalLoadedClassCount()Returns the value of thetotalLoadedClassCountrecord component.- Returns:
- the value of the
totalLoadedClassCountrecord component
-
currentLoadedClassCount
public int currentLoadedClassCount()Returns the value of thecurrentLoadedClassCountrecord component.- Returns:
- the value of the
currentLoadedClassCountrecord component
-
threads
-