Class SystemResourcesCounter

  • All Implemented Interfaces:
    Runnable

    @ThreadSafe
    public class SystemResourcesCounter
    extends Thread
    Daemon thread probing system resources.

    To accurately and consistently report CPU and network usage we have to periodically probe CPU ticks and network sent/received bytes and then convert those values to CPU usage and send/receive byte rates.

    • Constructor Detail

      • SystemResourcesCounter

        public SystemResourcesCounter​(Duration probeInterval)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • getCpuUser

        public double getCpuUser()
      • getCpuNice

        public double getCpuNice()
      • getCpuSys

        public double getCpuSys()
      • getCpuIdle

        public double getCpuIdle()
      • getIOWait

        public double getIOWait()
      • getCpuIrq

        public double getCpuIrq()
      • getCpuSoftIrq

        public double getCpuSoftIrq()
      • getCpuSteal

        public double getCpuSteal()
      • getCpuUsage

        public double getCpuUsage()
      • getCpuLoad1

        public double getCpuLoad1()
      • getCpuLoad5

        public double getCpuLoad5()
      • getCpuLoad15

        public double getCpuLoad15()
      • getProcessorsCount

        public int getProcessorsCount()
      • getCpuUsagePerProcessor

        public double getCpuUsagePerProcessor​(int processor)
      • getNetworkInterfaceNames

        public String[] getNetworkInterfaceNames()
      • getReceiveRatePerInterface

        public long getReceiveRatePerInterface​(int interfaceNo)
      • getSendRatePerInterface

        public long getSendRatePerInterface​(int interfaceNo)