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 Details

    • pid

      private final long pid
      The field for the pid record component.
    • cpuUsage

      private final double cpuUsage
      The field for the cpuUsage record component.
    • systemCpuUsage

      private final double systemCpuUsage
      The field for the systemCpuUsage record component.
    • maxHeapMemory

      private final long maxHeapMemory
      The field for the maxHeapMemory record component.
    • heapUsageMemory

      private final long heapUsageMemory
      The field for the heapUsageMemory record component.
    • noHeapUsageMemory

      private final long noHeapUsageMemory
      The field for the noHeapUsageMemory record component.
    • unloadedClassCount

      private final long unloadedClassCount
      The field for the unloadedClassCount record component.
    • totalLoadedClassCount

      private final long totalLoadedClassCount
      The field for the totalLoadedClassCount record component.
    • currentLoadedClassCount

      private final int currentLoadedClassCount
      The field for the currentLoadedClassCount record component.
    • threads

      @NonNull private final @NonNull Collection<ThreadSnapshot> threads
      The field for the threads record component.
    • MEMORY_MX_BEAN

      private static final MemoryMXBean MEMORY_MX_BEAN
    • THREAD_MX_BEAN

      private static final ThreadMXBean THREAD_MX_BEAN
    • CLASS_LOADING_MX_BEAN

      private static final ClassLoadingMXBean CLASS_LOADING_MX_BEAN
    • OS_BEAN

      private static final OperatingSystemMXBean OS_BEAN
    • OWN_PID

      private static final long OWN_PID
    • EMPTY

      private static final ProcessSnapshot 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 a ProcessSnapshot record class.
      Parameters:
      pid - the value for the pid record component
      cpuUsage - the value for the cpuUsage record component
      systemCpuUsage - the value for the systemCpuUsage record component
      maxHeapMemory - the value for the maxHeapMemory record component
      heapUsageMemory - the value for the heapUsageMemory record component
      noHeapUsageMemory - the value for the noHeapUsageMemory record component
      unloadedClassCount - the value for the unloadedClassCount record component
      totalLoadedClassCount - the value for the totalLoadedClassCount record component
      currentLoadedClassCount - the value for the currentLoadedClassCount record component
      threads - the value for the threads record component
  • Method Details

    • empty

      @NonNull public static @NonNull ProcessSnapshot empty()
      Get a jvm static process snapshot which holds no information about any process.
      Returns:
      an empty static process snapshot.
    • self

      @NonNull public static @NonNull ProcessSnapshot 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

      Overrides:
      clone in class Object
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • pid

      public long pid()
      Returns the value of the pid record component.
      Returns:
      the value of the pid record component
    • cpuUsage

      public double cpuUsage()
      Returns the value of the cpuUsage record component.
      Returns:
      the value of the cpuUsage record component
    • systemCpuUsage

      public double systemCpuUsage()
      Returns the value of the systemCpuUsage record component.
      Returns:
      the value of the systemCpuUsage record component
    • maxHeapMemory

      public long maxHeapMemory()
      Returns the value of the maxHeapMemory record component.
      Returns:
      the value of the maxHeapMemory record component
    • heapUsageMemory

      public long heapUsageMemory()
      Returns the value of the heapUsageMemory record component.
      Returns:
      the value of the heapUsageMemory record component
    • noHeapUsageMemory

      public long noHeapUsageMemory()
      Returns the value of the noHeapUsageMemory record component.
      Returns:
      the value of the noHeapUsageMemory record component
    • unloadedClassCount

      public long unloadedClassCount()
      Returns the value of the unloadedClassCount record component.
      Returns:
      the value of the unloadedClassCount record component
    • totalLoadedClassCount

      public long totalLoadedClassCount()
      Returns the value of the totalLoadedClassCount record component.
      Returns:
      the value of the totalLoadedClassCount record component
    • currentLoadedClassCount

      public int currentLoadedClassCount()
      Returns the value of the currentLoadedClassCount record component.
      Returns:
      the value of the currentLoadedClassCount record component
    • threads

      Returns the value of the threads record component.
      Returns:
      the value of the threads record component