Esempio n. 1
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;
  }
Esempio n. 2
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;
  }
Esempio n. 3
0
  public List<StoreIncomingStatisticsElement> processValueInstrumentation(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();

    String[] params = line.split(DELIMETER);
    if (params.length == 7) {

      String agentName = params[0];
      String guiPath = params[1];
      String path = params[2].replaceAll("_", " ");
      String value = params[3];
      Long timeperiod;
      UnitType unitType = getUnitType(params[4]);
      ValueType valueType = getValueType(params[5]);

      String timestampStr = params[6];
      timeperiod = 0l;
      try {
        timeperiod = Long.parseLong(timestampStr);
        timeperiod = ((long) (timeperiod / 15000));
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

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

      StoreIncomingStatisticsElement statElem = new StoreIncomingStatisticsElement();
      statElem.setGuiPath(sb.toString());
      statElem.setTimeperiod(timeperiod);
      statElem.setValue(value);
      statElem.setValueType(valueType.value());
      statElem.setUnitType((unitType.value()));
      statList.add(statElem);
    }
    return statList;
  }
Esempio n. 4
0
  public static StringBuilder convertStatListToJson(
      List<StoreIncomingStatisticsElement> statElemList, String password) {
    StringBuilder jsonBuilder = new StringBuilder();
    jsonBuilder.append("{ \"storeLiveStatistics\": [");
    for (int index = 0; index < statElemList.size() - 1; index++) {
      StoreIncomingStatisticsElement element = statElemList.get(index);
      jsonBuilder.append("{ ");
      jsonBuilder.append("\"guiPath\": \"" + element.getGuiPath() + "\", ");
      jsonBuilder.append("\"timeperiod\": " + element.getTimeperiod() + ", ");
      jsonBuilder.append("\"value\": \"" + element.getValue() + "\", ");
      jsonBuilder.append("\"valueType\": \"" + element.getValueType() + "\", ");
      jsonBuilder.append("\"unitType\": \"" + element.getUnitType() + "\"");
      jsonBuilder.append("}, ");
    }

    // Last element
    if (statElemList.size() > 0) {
      StoreIncomingStatisticsElement element = statElemList.get(statElemList.size() - 1);
      jsonBuilder.append("{ ");
      jsonBuilder.append("\"guiPath\": \"" + element.getGuiPath() + "\", ");
      jsonBuilder.append("\"timeperiod\": " + element.getTimeperiod() + ", ");
      jsonBuilder.append("\"value\": \"" + element.getValue() + "\", ");
      jsonBuilder.append("\"valueType\": \"" + element.getValueType() + "\", ");
      jsonBuilder.append("\"unitType\": \"" + element.getUnitType() + "\"");
      jsonBuilder.append("}");
    }
    jsonBuilder.append("], \"liveStatisticsToken\": \"" + password + "\" }");
    return jsonBuilder;
  }
Esempio n. 5
0
  public List<StoreIncomingStatisticsElement> processMemoryPool(String line) {
    List<StoreIncomingStatisticsElement> statList = new ArrayList<StoreIncomingStatisticsElement>();

    String[] params = line.split(DELIMETER);
    String agentName;
    String name;
    String maxMem;
    String usedMem;
    String commitedMem;
    String initMem;
    String timestampStr;

    if (params.length == 7) {
      agentName = params[0];
      name = params[1].replaceAll("_", " ");
      maxMem = params[2];
      usedMem = params[3];
      commitedMem = params[4];
      initMem = params[5];
      timestampStr = params[6];
      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:MemoryPool:" + name + ":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:MemoryPool:" + name + ":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:MemoryPool:" + name + ":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:MemoryPool:" + name + ":Committed");
      commitedElem.setTimeperiod(timeperiod);
      commitedElem.setValue(commitedMem);
      commitedElem.setUnitType(UnitType.N.value());
      commitedElem.setValueType(ValueType.VALUE.value());
      statList.add(commitedElem);
    }
    return statList;
  }
Esempio n. 6
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;
  }
Esempio n. 7
0
  public List<StoreIncomingStatisticsElement> processHeapMemory(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)); // Data is stored in 15-second intervals
      } catch (NumberFormatException nfe) {
        log.error("Unable to read in timestamp");
      }

      StoreIncomingStatisticsElement initElem = new StoreIncomingStatisticsElement();
      initElem.setGuiPath(agentName + ":Memory:Heap: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:Heap: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:Heap: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:Heap:Committed");
      commitedElem.setTimeperiod(timeperiod);
      commitedElem.setValue(commitedMem);
      commitedElem.setUnitType(UnitType.N.value());
      commitedElem.setValueType(ValueType.VALUE.value());
      statList.add(commitedElem);
    }
    return statList;
  }
Esempio n. 8
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;
  }