예제 #1
0
  public List<StoreIncomingStatisticsElement> processNonHeapMemory(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();
    String[] params = line.split(DELIMETER);
    String agentName;
    String maxMem;
    String usedMem;
    String commitedMem;
    String initMem;
    String timestampStr;

    if (params.length == 6) {
      agentName = params[0];
      maxMem = params[1];
      usedMem = params[2];
      commitedMem = params[3];
      initMem = params[4];
      timestampStr = params[5];
      Long timeperiod = 0l;
      try {
        timeperiod = Long.parseLong(timestampStr);
        timeperiod =
            ((long) (timeperiod / 15000)); // Round down to nearest 15 second period 00, 15, 30, 45
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

      StoreIncomingStatisticsElement initElem = new StoreIncomingStatisticsElement();
      initElem.setGuiPath(agentName + ":Memory:NonHeap:Init");
      initElem.setTimeperiod(timeperiod);
      initElem.setValue(initMem);
      initElem.setUnitType(UnitType.N.value());
      initElem.setValueType(ValueType.VALUE.value());
      statList.add(initElem);

      StoreIncomingStatisticsElement maxElem = new StoreIncomingStatisticsElement();
      maxElem.setGuiPath(agentName + ":Memory:NonHeap:Max");
      maxElem.setTimeperiod(timeperiod);
      maxElem.setValue(maxMem);
      maxElem.setUnitType(UnitType.N.value());
      maxElem.setValueType(ValueType.VALUE.value());
      statList.add(maxElem);

      StoreIncomingStatisticsElement usedElem = new StoreIncomingStatisticsElement();
      usedElem.setGuiPath(agentName + ":Memory:NonHeap:Used");
      usedElem.setTimeperiod(timeperiod);
      usedElem.setValue(usedMem);
      usedElem.setUnitType(UnitType.N.value());
      usedElem.setValueType(ValueType.VALUE.value());
      statList.add(usedElem);

      StoreIncomingStatisticsElement commitedElem = new StoreIncomingStatisticsElement();
      commitedElem.setGuiPath(agentName + ":Memory:NonHeap:Committed");
      commitedElem.setTimeperiod(timeperiod);
      commitedElem.setValue(commitedMem);
      commitedElem.setUnitType(UnitType.N.value());
      commitedElem.setValueType(ValueType.VALUE.value());
      statList.add(commitedElem);
    }
    return statList;
  }
예제 #2
0
  public List<StoreIncomingStatisticsElement> processThreads(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();

    String[] params = line.split(DELIMETER);
    String agentName;
    String threadCount;
    String peakThreadCount;
    String totatStartedThreads;
    String timestampStr;

    if (params.length == 5) {
      agentName = params[0];
      threadCount = params[1];
      peakThreadCount = params[2];
      totatStartedThreads = params[3];
      timestampStr = params[4];
      Long timeperiod = 0l;
      try {
        timeperiod = Long.parseLong(timestampStr);
        timeperiod =
            ((long) (timeperiod / 15000)); // Round down to nearest 15 second period 00, 15, 30, 45
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

      StoreIncomingStatisticsElement maxElem = new StoreIncomingStatisticsElement();
      maxElem.setGuiPath(agentName + ":Threads:ThreadCount");
      maxElem.setTimeperiod(timeperiod);
      maxElem.setValue(threadCount);
      maxElem.setUnitType(UnitType.N.value());
      maxElem.setValueType(ValueType.VALUE.value());
      statList.add(maxElem);

      StoreIncomingStatisticsElement usedElem = new StoreIncomingStatisticsElement();
      usedElem.setGuiPath(agentName + ":Threads:PeakThreadCount");
      usedElem.setTimeperiod(timeperiod);
      usedElem.setValue(peakThreadCount);
      usedElem.setUnitType(UnitType.N.value());
      usedElem.setValueType(ValueType.VALUE.value());
      statList.add(usedElem);

      StoreIncomingStatisticsElement commitedElem = new StoreIncomingStatisticsElement();
      commitedElem.setGuiPath(agentName + ":Threads:TotalStartedThreads");
      commitedElem.setTimeperiod(timeperiod);
      commitedElem.setValue(totatStartedThreads);
      commitedElem.setUnitType(UnitType.N.value());
      commitedElem.setValueType(ValueType.VALUE.value());
      statList.add(commitedElem);
    }
    return statList;
  }
예제 #3
0
  public List<StoreIncomingStatisticsElement> processGCTime(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();

    String[] params = line.split(DELIMETER);
    String agentName;
    // String gcCountStr;
    String gcTimeStr;
    // String msTimeStr;
    String timestampStr;
    if (params.length == 3) {
      agentName = params[0];
      // gcCountStr = params[1];
      gcTimeStr = params[1];
      // msTimeStr = params[3];
      timestampStr = params[2];
      Long timeperiod = 0l;
      try {
        timeperiod = Long.parseLong(timestampStr);
        timeperiod =
            ((long) (timeperiod / 15000)); // Round down to nearest 15 second period 00, 15, 30, 45
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

      StoreIncomingStatisticsElement commitedElem = new StoreIncomingStatisticsElement();
      commitedElem.setGuiPath(agentName + ":Memory:GC:Time Spent In GC(%)");
      commitedElem.setTimeperiod(timeperiod);
      commitedElem.setValue(gcTimeStr);
      commitedElem.setUnitType(UnitType.N.value());
      commitedElem.setValueType(ValueType.VALUE.value());
      statList.add(commitedElem);
    }
    return statList;
  }
  @Override
  public List<LiveStatistics> getLiveStatistics(
      String guiPath, String accountName, Long minTimeperiod, Long maxTimeperiod) {
    Long fromHoursSince1970 = minTimeperiod / 240;
    Long toHoursSince1970 = maxTimeperiod / 240;

    List<LiveStatistics> retList = new ArrayList<LiveStatistics>();

    for (Long index = fromHoursSince1970; index <= toHoursSince1970; index++) {
      BasicMetricHour metricHour = getMetricHour(accountName, guiPath, index);
      if (metricHour == null) {
        metricHour =
            new BasicMetricHour(
                guiPath, accountName, index, ValueType.VALUE.value(), UnitType.N.value());
      }

      // If this is the first hour, start from the correct 15-second timeslot within the hour
      Integer minTimeperiodWithinTheHour = 0;
      if (index.longValue() == fromHoursSince1970.longValue()) {
        minTimeperiodWithinTheHour =
            LiveStatisticsUtil.getFifteensecondTimeperiodsSinceStartOfHour(minTimeperiod * 15);
      }

      // If this is the last hour, end with the correct 15-second timeslot within the hour
      Integer maxTimeperiodWithinTheHour = null;
      if (index.longValue() == toHoursSince1970.longValue()) {
        maxTimeperiodWithinTheHour =
            LiveStatisticsUtil.getFifteensecondTimeperiodsSinceStartOfHour(maxTimeperiod * 15);
      }

      retList.addAll(
          createLivestatisticsFromMetricHour(
              metricHour, minTimeperiodWithinTheHour, maxTimeperiodWithinTheHour, index));
    }

    return retList;
  }
예제 #5
0
  public List<StoreIncomingStatisticsElement> processThreadsLiveByType(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();

    // JSFlotAgent;java.lang.Thread;0;1272306420000
    String[] params = line.split(DELIMETER);
    String agentName;
    String threadname;
    String threadCount;
    String timestampStr;

    if (params.length == 4) {
      agentName = params[0];
      threadname = params[1];
      threadCount = params[2];
      timestampStr = params[3];
      Long timeperiod = 0l;
      try {
        timeperiod = Long.parseLong(timestampStr);
        timeperiod =
            ((long) (timeperiod / 15000)); // Round down to nearest 15 second period 00, 15, 30, 45
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

      StringBuilder sb = new StringBuilder();
      sb.append(agentName).append(":Threads:").append(threadname).append(":ThreadCount");

      StoreIncomingStatisticsElement maxElem = new StoreIncomingStatisticsElement();
      maxElem.setGuiPath(sb.toString());
      maxElem.setTimeperiod(timeperiod);
      maxElem.setValue(threadCount);
      maxElem.setUnitType(UnitType.N.value());
      maxElem.setValueType(ValueType.VALUE.value());
      statList.add(maxElem);
    }
    return statList;
  }
예제 #6
0
  public List<StoreIncomingStatisticsElement> processBtraceProfiling(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();
    // agentname package.Class method timeperiod exectime guiPath
    String[] params = line.split(DELIMETER);
    String agentName;
    String className;
    String methodName;
    Long timeperiod;
    String invocations;
    String totalSelftime;
    String avgSelftime;
    String minSelftime;
    String maxSelftime;
    String totalWalltime;
    String avgWalltime;
    String minWalltime;
    String maxWalltime;
    String guiPath = null;

    if (params.length >= 13 && !line.contains("N/A")) {
      if (params.length == 13) {
        guiPath = "Custom";
      }
      if (params.length == 14) {
        guiPath = params[13];
      }

      if (guiPath != null && guiPath.length() > 0) {
        agentName = params[0];
        className = params[1];
        methodName = params[2];
        String timestampStr = params[3];
        timeperiod = 0l;
        try {
          timeperiod = Long.parseLong(timestampStr);
          timeperiod = ((long) (timeperiod / 15000));
        } catch (NumberFormatException nfe) {
          log.error("Unable to read in timestamp");
        }

        invocations = params[4];
        totalSelftime = params[5];
        avgSelftime = params[6];
        minSelftime = params[7];
        maxSelftime = params[8];
        totalWalltime = params[9];
        avgWalltime = params[10];
        minWalltime = params[11];
        maxWalltime = params[12];

        StringBuilder sb = new StringBuilder();
        sb.append(agentName)
            .append(":")
            .append(guiPath)
            .append(":")
            .append(className)
            .append(":")
            .append(methodName);

        StoreIncomingStatisticsElement statElem = new StoreIncomingStatisticsElement();
        statElem.setGuiPath(sb.toString() + ":Calls Per Interval");
        statElem.setTimeperiod(timeperiod);
        statElem.setValue(invocations);
        statElem.setUnitType(UnitType.N.value());
        statElem.setValueType(ValueType.AGGREGATE.value());
        statList.add(statElem);

        StoreIncomingStatisticsElement statElem2 = new StoreIncomingStatisticsElement();
        statElem2.setGuiPath(sb.toString() + ":Total Selftime");
        statElem2.setTimeperiod(timeperiod);
        statElem2.setValue(totalSelftime);
        statElem2.setUnitType(UnitType.NS.value());
        statElem2.setValueType(ValueType.AGGREGATE.value());
        statList.add(statElem2);

        StoreIncomingStatisticsElement statElem3 = new StoreIncomingStatisticsElement();
        statElem3.setGuiPath(sb.toString() + ":Average Selftime");
        statElem3.setTimeperiod(timeperiod);
        statElem3.setValue(avgSelftime);
        statElem3.setUnitType(UnitType.NS.value());
        statElem3.setValueType(ValueType.AVERAGE.value());
        statList.add(statElem3);

        StoreIncomingStatisticsElement statElem4 = new StoreIncomingStatisticsElement();
        statElem4.setGuiPath(sb.toString() + ":Max Selftime");
        statElem4.setTimeperiod(timeperiod);
        statElem4.setValue(maxSelftime);
        statElem4.setUnitType(UnitType.NS.value());
        statElem4.setValueType(ValueType.VALUE.value());
        statList.add(statElem4);

        StoreIncomingStatisticsElement statElem5 = new StoreIncomingStatisticsElement();
        statElem5.setGuiPath(sb.toString() + ":Min Selftime");
        statElem5.setTimeperiod(timeperiod);
        statElem5.setValue(minSelftime);
        statElem5.setUnitType(UnitType.NS.value());
        statElem5.setValueType(ValueType.VALUE.value());
        statList.add(statElem5);

        StoreIncomingStatisticsElement statElem6 = new StoreIncomingStatisticsElement();
        statElem6.setGuiPath(sb.toString() + ":Total Walltime");
        statElem6.setTimeperiod(timeperiod);
        statElem6.setValue(totalWalltime);
        statElem6.setUnitType(UnitType.NS.value());
        statElem6.setValueType(ValueType.AGGREGATE.value());
        statList.add(statElem6);

        StoreIncomingStatisticsElement statElem7 = new StoreIncomingStatisticsElement();
        statElem7.setGuiPath(sb.toString() + ":Avgerage Walltime");
        statElem7.setTimeperiod(timeperiod);
        statElem7.setValue(avgWalltime);
        statElem7.setUnitType(UnitType.NS.value());
        statElem7.setValueType(ValueType.AVERAGE.value());
        statList.add(statElem7);

        StoreIncomingStatisticsElement statElem8 = new StoreIncomingStatisticsElement();
        statElem8.setGuiPath(sb.toString() + ":Max Walltime");
        statElem8.setTimeperiod(timeperiod);
        statElem8.setValue(maxWalltime);
        statElem8.setUnitType(UnitType.NS.value());
        statElem8.setValueType(ValueType.VALUE.value());
        statList.add(statElem8);

        StoreIncomingStatisticsElement statElem9 = new StoreIncomingStatisticsElement();
        statElem9.setGuiPath(sb.toString() + ":Min Walltime");
        statElem9.setTimeperiod(timeperiod);
        statElem9.setValue(minWalltime);
        statElem9.setUnitType(UnitType.NS.value());
        statElem9.setValueType(ValueType.VALUE.value());
        statList.add(statElem9);
      }
    }
    return statList;
  }