Exemplo n.º 1
0
  /**
   * @param midList
   * @param compMetric
   * @return
   * @throws RuntimeException
   * @throws RemoteException
   * @throws InvalidPropertyFaultMsg
   * @throws RuntimeFaultFaultMsg
   */
  private static XMLGregorianCalendar displayStats(
      List<PerfMetricId> midList, PerfCompositeMetric compMetric)
      throws RuntimeException, RemoteException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    if (compMetric == null || (compMetric.getEntity() == null)) {
      return null;
    }

    List<Object[]> data = new ArrayList<Object[]>();
    PerfEntityMetric entityMetric = (PerfEntityMetric) compMetric.getEntity();
    PerfMetricIntSeries intSeries = (PerfMetricIntSeries) entityMetric.getValue().get(0);
    int numSamples = entityMetric.getSampleInfo().size();

    XMLGregorianCalendar timeStamp =
        entityMetric.getSampleInfo().get(numSamples - 1).getTimestamp();
    long overallUsage = intSeries.getValue().get(numSamples - 1);
    System.out.println("Info Updated");
    int numColumns = midList.size() + 1;
    List<PerfEntityMetricBase> listpemb = compMetric.getChildEntity();
    List<PerfEntityMetricBase> childEntityMetric = listpemb;
    for (int childNum = 0; childNum < childEntityMetric.size(); childNum++) {
      PerfEntityMetric childStats = (PerfEntityMetric) childEntityMetric.get(childNum);
      String childName = getEntityName(childStats.getEntity());
      int numChildSamples = childStats.getSampleInfo().size();
      Object[] tableData = new Object[numColumns];
      tableData[0] = childName;

      for (int i = 0; i < childStats.getValue().size(); i++) {
        PerfMetricIntSeries childSeries = (PerfMetricIntSeries) childStats.getValue().get(i);
        int col = findStatsIndex(midList, childSeries.getId());
        if (col >= 0) {
          long statsVal = childSeries.getValue().get(numChildSamples - 1);
          tableData[col + 1] = new Long(statsVal);
        }
      }
      data.add(tableData);
    }

    if (statsTable != null) {
      statsTable.setData(timeStamp.toGregorianCalendar(), overallUsage, "Mhz", data);
    }
    return timeStamp;
  }