Package com.dianping.cat.statistic.ServerStatistic

Examples of com.dianping.cat.statistic.ServerStatistic.Statistic


    if (end > current) {
      end = current;
    }
    for (; start < end; start += minute) {
      Statistic state = m_serverStateManager.findOrCreateState(start);
      Message temp = machine.findOrCreateMessage(start);
      Map<String, AtomicLong> totals = state.getMessageTotals();
      Map<String, AtomicLong> totalLosses = state.getMessageTotalLosses();
      Map<String, AtomicLong> sizes = state.getMessageSizes();

      for (Entry<String, AtomicLong> entry : totals.entrySet()) {
        String domain = entry.getKey();
        long value = entry.getValue().get();
        ProcessDomain processDomain = machine.findOrCreateProcessDomain(domain);
        Detail detail = processDomain.findOrCreateDetail(start);

        processDomain.setTotal(value + processDomain.getTotal());
        detail.setTotal(value + detail.getTotal());
      }
      for (Entry<String, AtomicLong> entry : totalLosses.entrySet()) {
        String domain = entry.getKey();
        long value = entry.getValue().get();
        ProcessDomain processDomain = machine.findOrCreateProcessDomain(domain);
        Detail detail = processDomain.findOrCreateDetail(start);

        processDomain.setTotalLoss(value + processDomain.getTotalLoss());
        detail.setTotalLoss(value + detail.getTotalLoss());
      }
      for (Entry<String, AtomicLong> entry : sizes.entrySet()) {
        String domain = entry.getKey();
        long value = entry.getValue().get();
        ProcessDomain processDomain = machine.findOrCreateProcessDomain(domain);
        Detail detail = processDomain.findOrCreateDetail(start);

        processDomain.setSize(value + processDomain.getSize());
        detail.setSize(value + detail.getSize());
      }

      long messageTotal = state.getMessageTotal();
      long messageTotalLoss = state.getMessageTotalLoss();
      long messageSize = state.getMessageSize();
      long blockTotal = state.getBlockTotal();
      long blockLoss = state.getBlockLoss();
      long blockTime = state.getBlockTime();
      long pigeonTimeError = state.getPigeonTimeError();
      long networkTimeError = state.getNetworkTimeError();
      long messageDump = state.getMessageDump();
      long messageDumpLoss = state.getMessageDumpLoss();
      int processDelayCount = state.getProcessDelayCount();
      double processDelaySum = state.getProcessDelaySum();

      temp.setTotal(messageTotal).setTotalLoss(messageTotalLoss).setSize(messageSize);
      temp.setBlockTotal(blockTotal).setBlockLoss(blockLoss).setBlockTime(blockTime);
      temp.setPigeonTimeError(pigeonTimeError).setNetworkTimeError(networkTimeError).setDump(messageDump);
      temp.setDumpLoss(messageDumpLoss).setDelayCount(processDelayCount).setDelaySum(processDelaySum);
View Full Code Here


    Assert.assertEquals(true, null != manager.findOrCreateState(time));
  }

  private Statistic findState(ServerStatisticManager manager, long time) {
    Statistic state = manager.findOrCreateState(time);

    if (state == null) {
      state = manager.findOrCreateState(time + 60 * 1000);
    }
    return state;
View Full Code Here

TOP

Related Classes of com.dianping.cat.statistic.ServerStatistic.Statistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.