Пример #1
0
 private void calPerf() {
   this.bytesRead = (long) (vol.getReadBytes() - this.pbytesRead);
   this.pbytesRead = vol.getReadBytes();
   MDC.put("bytesRead", Long.toString(bytesRead));
   this.bytesWritten = (long) (vol.getActualWriteBytes() - this.pbytesWritten);
   this.pbytesWritten = vol.getActualWriteBytes();
   MDC.put("bytesWritten", Long.toString(this.bytesWritten));
   this.duplicateBytes = (long) (vol.getDuplicateBytes() - this.pduplicateBytes);
   this.pduplicateBytes = vol.getDuplicateBytes();
   MDC.put("duplicateBytes", Long.toString(this.duplicateBytes));
   this.virtualBytesWritten = (long) (vol.getVirtualBytesWritten() - this.pvirtualBytesWritten);
   this.pvirtualBytesWritten = vol.getVirtualBytesWritten();
   MDC.put("virtualBytesWritten", Long.toString(this.virtualBytesWritten));
   this.RIOPS = (long) (vol.getReadOperations() - this.pRIOPS);
   this.pRIOPS = vol.getReadOperations();
   MDC.put("RIOPS", Long.toString(this.RIOPS));
   this.WIOPS = (long) (vol.getWriteOperations() - this.pWIOPS);
   this.pWIOPS = vol.getWriteOperations();
   this.dseSz = HCServiceProxy.getDSESize();
   this.dseCompSz = HCServiceProxy.getDSECompressedSize();
   MDC.put("dseSz", Long.toString(this.dseSz));
   MDC.put("dseCompSz", Long.toString(this.dseCompSz));
   MDC.put("WIOPS", Long.toString(this.WIOPS));
   MDC.put("sdfsCpuLoad", Double.toString(perf.getProcessCpuLoad()));
   MDC.put("sdfsCpuTime", Double.toString(perf.getProcessCpuTime()));
   MDC.put("systemCpuLoad", Double.toString(perf.getSystemCpuLoad()));
   MDC.put("systemCpuAverage", Double.toString(perf.getSystemLoadAverage()));
   MDC.put("freeMemory", Long.toString(perf.getFreePhysicalMemorySize()));
   MDC.put("totalMemory", Long.toString(perf.getTotalPhysicalMemorySize()));
   MDC.put("freeSwap", Long.toString(perf.getFreeSwapSpaceSize()));
   MDC.put("totalSwap", Long.toString(perf.getTotalSwapSpaceSize()));
   log.info(vol.getName());
   MDC.clear();
 }
Пример #2
0
  public static long processCpuTime() {

    if (oracleJVMAndUnix) {

      UnixOperatingSystemMXBean unix =
          (UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
      return unix.getProcessCpuTime();
    } else {
      return -1;
    }
  }