code: @Override
    public synchronized float getCpuUsage() {
      readProcStatFile();
      sampleTime = getCurrentTime();
      if (lastSampleTime == UNAVAILABLE ||
          lastSampleTime > sampleTime) {
        // lastSampleTime > sampleTime may happen when the system time is changed
        lastSampleTime = sampleTime;
        lastCumulativeCpuTime = cumulativeCpuTime;
        return cpuUsage;
      }
      // When lastSampleTime is sufficiently old, update cpuUsage.
      // Also take a sample of the current time and cumulative CPU time for the
      // use of the next calculation.
      final long MINIMUM_UPDATE_INTERVAL = 10 * jiffyLengthInMillis;
      if (sampleTime > lastSampleTime + MINIMUM_UPDATE_INTERVAL) {
        cpuUsage = (float)(cumulativeCpuTime - lastCumulativeCpuTime) * 100F /
                   ((float)(sampleTime - lastSampleTime) * getNumProcessors());
        lastSampleTime = sampleTime;
        lastCumulativeCpuTime = cumulativeCpuTime;
      }
      return cpuUsage;
    }
docs: {@inheritDoc}