コード例 #1
0
ファイル: VolumeIOMeter.java プロジェクト: swang001/sdfs
 public VolumeIOMeter(Volume vol) {
   RollingFileAppender app = null;
   try {
     app = new RollingFileAppender(new JSONVolPerfLayout(), vol.getPerfMonFile(), true);
     app.setMaxBackupIndex(2);
     app.setMaxFileSize("10MB");
   } catch (IOException e) {
     log.debug("unable to change appender", e);
   }
   this.vol = vol;
   log.addAppender(app);
   log.setLevel(Level.INFO);
   th = new Thread(this);
   th.start();
 }
コード例 #2
0
ファイル: VolumeIOMeter.java プロジェクト: swang001/sdfs
 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();
 }