public void caculateResource(){ this.endCpu = SysJMX.getProcessCPU(); long [] gcInfo = SysJMX.getCurrentProcGcInfo(); this.gcCount = gcInfo[0]; this.gcTime = gcInfo[1]; }
@Counter public void getGCInfo(CounterBasket pw) { long[] gcInfo = SysJMX.getCurrentProcGcInfo(); if (oldGc == null) { oldGc = gcInfo; return; } long dCount = gcInfo[0] - oldGc[0]; long dTime = gcInfo[1] - oldGc[1]; oldGc = gcInfo; gcCountInfo.add(dCount); gcTimeInfo.add(dTime); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue(dCount)); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue(dTime)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue((long) gcCountInfo.getSum(300))); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue((long) gcTimeInfo.getSum(300))); } @Counter
@Counter public void getGCInfo(CounterBasket pw) { long[] gcInfo = SysJMX.getCurrentProcGcInfo(); if (oldGc == null) { oldGc = gcInfo; return; } long dCount = gcInfo[0] - oldGc[0]; long dTime = gcInfo[1] - oldGc[1]; oldGc = gcInfo; gcCountInfo.add(dCount); gcTimeInfo.add(dTime); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue(dCount)); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue(dTime)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue((long) gcCountInfo.getSum(300))); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue((long) gcTimeInfo.getSum(300))); } @Counter
@Counter public void getGCInfo(CounterBasket pw) { long[] gcInfo = SysJMX.getCurrentProcGcInfo(); if (oldGc == null) { oldGc = gcInfo; return; } long dCount = gcInfo[0] - oldGc[0]; long dTime = gcInfo[1] - oldGc[1]; oldGc = gcInfo; gcCountInfo.add(dCount); gcTimeInfo.add(dTime); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue(dCount)); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue(dTime)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_GC_COUNT, new DecimalValue((long) gcCountInfo.getSum(300))); p.put(CounterConstants.JAVA_GC_TIME, new DecimalValue((long) gcTimeInfo.getSum(300))); } @Counter