public static void counter(CounterBasket cw) { if (plugIn != null) { try { plugIn.counter(cw.getPack(TimeTypeEnum.REALTIME)); } catch (Throwable th) { } } } }
public static void counter(CounterBasket cw) { if (plugIn != null) { try { plugIn.counter(cw.getPack(TimeTypeEnum.REALTIME)); } catch (Throwable th) { } } } }
public PerfCounterPack getPack(byte timeType) { return getPack(Configure.getInstance().getObjName(), timeType); }
public PerfCounterPack getPack(byte timeType) { return getPack(Configure.getInstance().getObjName(), timeType); }
public PerfCounterPack getPack(byte timeType) { return getPack(Configure.getInstance().getObjName(), timeType); }
@Counter public void recentUser(CounterBasket pw) { int users =MeterUsers.getUsers(); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.WAS_RECENT_USER, new DecimalValue(users)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.WAS_RECENT_USER, new DecimalValue(users)); } }
@Counter public void recentUser(CounterBasket pw) { int users =MeterUsers.getUsers(); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.WAS_RECENT_USER, new DecimalValue(users)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.WAS_RECENT_USER, new DecimalValue(users)); } }
public void process(CounterBasket pw) throws IOException { Configure conf = Configure.getInstance(); boolean redisEnabled = conf.getBoolean("redis_enabled", false); if (redisEnabled) { String serverIp = conf.getValue("redis_server_ip", "127.0.0.1"); int serverPort = conf.getInt("redis_server_port", 6379); String perfInfo = getRedisPerfInfo(serverIp, serverPort); String[] lines = perfInfo.split("\n"); PerfCounterPack p = pw.getPack(conf.getObjName(), TimeTypeEnum.REALTIME); for (String line : lines) { String key = line.substring(0, line.indexOf(':')); String value = line.substring(line.indexOf(':') + 1); if (floatSet.contains(key)) { p.put(key, new FloatValue(Float.valueOf(value.trim()))); } if (decimalSet.contains(key)) { p.put(key, new DecimalValue(Long.valueOf(value.trim()))); } } } }
@Counter public void cpuTime(CounterBasket pw) { if(SysJMX.isProcessCPU()==false) return; long cpu = SysJMX.getProcessCPU(); if (oldCpu<=0) { oldCpu = cpu; return; } long dTime = cpu - oldCpu; oldCpu = cpu; cpuTimeInfo.add(dTime); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_CPU_TIME, new DecimalValue(dTime)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_CPU_TIME, new DecimalValue((long) cpuTimeInfo.getSum(300))); }
@Counter public void cpuTime(CounterBasket pw) { if(SysJMX.isProcessCPU()==false) return; long cpu = SysJMX.getProcessCPU(); if (oldCpu<=0) { oldCpu = cpu; return; } long dTime = cpu - oldCpu; oldCpu = cpu; cpuTimeInfo.add(dTime); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_CPU_TIME, new DecimalValue(dTime)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_CPU_TIME, new DecimalValue((long) cpuTimeInfo.getSum(300))); }
@Counter public void getHeapUsage(CounterBasket pw) { long total = Runtime.getRuntime().totalMemory(); long free = Runtime.getRuntime().freeMemory(); float tatalMb = (float) (total / 1024. / 1024.); float usedMb = (float) ((total - free) / 1024. / 1024.); heapmin.add(total - free); float used5MinAvgMb = (float) (heapmin.getAvg(300) / 1024. / 1024.); ListValue heapValues = new ListValue(); heapValues.add(tatalMb); heapValues.add(usedMb); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_HEAP_TOT_USAGE, heapValues); p.put(CounterConstants.JAVA_HEAP_USED, new FloatValue(usedMb)); p.put(CounterConstants.JAVA_HEAP_TOTAL, new FloatValue(tatalMb)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_HEAP_USED, new FloatValue(used5MinAvgMb)); p.put(CounterConstants.JAVA_HEAP_TOTAL, new FloatValue(tatalMb)); } }
@Counter public void getHeapUsage(CounterBasket pw) { long total = Runtime.getRuntime().totalMemory(); long free = Runtime.getRuntime().freeMemory(); float tatalMb = (float) (total / 1024. / 1024.); float usedMb = (float) ((total - free) / 1024. / 1024.); heapmin.add(total - free); float used5MinAvgMb = (float) (heapmin.getAvg(300) / 1024. / 1024.); ListValue heapValues = new ListValue(); heapValues.add(tatalMb); heapValues.add(usedMb); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_HEAP_TOT_USAGE, heapValues); p.put(CounterConstants.JAVA_HEAP_USED, new FloatValue(usedMb)); p.put(CounterConstants.JAVA_HEAP_TOTAL, new FloatValue(tatalMb)); p = pw.getPack(TimeTypeEnum.FIVE_MIN); p.put(CounterConstants.JAVA_HEAP_USED, new FloatValue(used5MinAvgMb)); p.put(CounterConstants.JAVA_HEAP_TOTAL, new FloatValue(tatalMb)); } }
@Counter public void process(CounterBasket pw) { if (availableFdInfo == false) { return; } // Currently supported only sun jvm on unix platform try { OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); if(os instanceof UnixOperatingSystemMXBean){ UnixOperatingSystemMXBean unixOs = (UnixOperatingSystemMXBean) os; long max = unixOs.getMaxFileDescriptorCount(); long open = unixOs.getOpenFileDescriptorCount(); ListValue fdUsage = new ListValue(); fdUsage.add(max); fdUsage.add(open); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_FD_USAGE, fdUsage); } else { availableFdInfo = false; } } catch (Throwable th) { Logger.println(th.getMessage()); availableFdInfo = false; } } }
@Counter public void process(CounterBasket pw) { if (availableFdInfo == false) { return; } // Currently supported only sun jvm on unix platform try { OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); if(os instanceof UnixOperatingSystemMXBean){ UnixOperatingSystemMXBean unixOs = (UnixOperatingSystemMXBean) os; long max = unixOs.getMaxFileDescriptorCount(); long open = unixOs.getOpenFileDescriptorCount(); ListValue fdUsage = new ListValue(); fdUsage.add(max); fdUsage.add(open); PerfCounterPack p = pw.getPack(TimeTypeEnum.REALTIME); p.put(CounterConstants.JAVA_FD_USAGE, fdUsage); } else { availableFdInfo = false; } } catch (Throwable th) { Logger.println(th.getMessage()); availableFdInfo = false; } } }
private void updateBatchService(){ PerfCounterPack pack = cb.getPack(conf.getObjName(), TimeTypeEnum.REALTIME); UdpLocalServer localServer = UdpLocalServer.getInstance(); pack.put(CounterConstants.BATCH_SERVICE, new DecimalValue(Main.batchMap.size())); pack.put(CounterConstants.BATCH_START, new DecimalValue(localServer.getStartBatchs())); pack.put(CounterConstants.BATCH_END, new DecimalValue(localServer.getEndBatchs())); pack.put(CounterConstants.BATCH_ENDNOSIGNAL, new DecimalValue(localServer.getEndNoSignalBatchs())); }
@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
if (mBeanServer.checkInit()) { StringEnumer stringEnumer = nameSet.keys(); PerfCounterPack pack = pw.getPack(TimeTypeEnum.REALTIME); while (stringEnumer.hasMoreElements()) { String next = stringEnumer.nextString();