Ejemplo n.º 1
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @return Hashtable: a table of string arrays, with the modifier as the key (or "?" if no
  *     modifier)
  */
 public static Hashtable processInclude(PMData data, String[] params) {
   if (data != null) {
     Hashtable ht = new Hashtable();
     // for each measurement...
     PmMeasurement[] m = data.getMeasurementList();
     for (int i = 0; i < m.length; i++) {
       if (m[i] == null) {
         continue;
       }
       String mod = m[i].getModifier();
       if (mod == null) {
         mod = "?";
       }
       String[] datum = (String[]) ht.get(mod);
       if (datum == null) {
         datum = new String[params.length];
         for (int j = 0; j < params.length; j++) {
           datum[j] = "";
         }
       }
       for (int j = 0; j < params.length; j++) {
         if (m[i].getParameterName().equals(params[j])) {
           datum[j] = m[i].getParameterValue();
         }
       }
       ht.put(mod, datum);
     }
     return ht;
   }
   return null;
 }
Ejemplo n.º 2
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @return Hashtable: a table of string arrays, with the modifier as the key (or "?" if no
  *     modifier)
  */
 public static Hashtable process(PMData data, String[] params) {
   if (data != null) {
     // table for temporary storage of param lists...
     Hashtable ht = new Hashtable();
     // for each param...
     for (int i = 0; i < params.length; i++) {
       PmMeasurement[] m = data.getMeasurementList();
       for (int j = 0; j < m.length; j++) {
         if (m[j].getParameterName().equals(params[i])) {
           String mod = m[j].getModifier();
           if (mod == null) {
             mod = "?";
           }
           String[] datum = (String[]) ht.get(mod);
           if (datum == null) {
             datum = new String[params.length];
             for (int k = 0; k < params.length; k++) {
               datum[k] = "";
             }
           }
           datum[i] = m[j].getParameterValue();
           ht.put(mod, datum);
         }
       }
     }
     return ht;
   }
   return null;
 }
Ejemplo n.º 3
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @param includeMod boolean: include modifier as first value if true
  * @return ArrayList: a list of string arrays
  */
 public static ArrayList processByMod(PMData data, String[] params, boolean includeMod) {
   if (data != null) {
     // table for temporary storage of param lists...
     Hashtable ht = new Hashtable();
     // for each param...
     for (int i = 0; i < params.length; i++) {
       PmMeasurement[] m = data.getMeasurementList();
       for (int j = 0; j < m.length; j++) {
         if (m[j].getParameterName().equals(params[i])) {
           String mod = m[j].getModifier();
           if (mod == null) {
             mod = "?";
           }
           String[] datum = (String[]) ht.get(mod);
           int offset = (includeMod ? 1 : 0);
           if (datum == null) {
             if (includeMod) {
               datum = new String[params.length + 1];
               datum[0] = mod;
             } else {
               datum = new String[params.length];
             }
             for (int k = 0; k < params.length; k++) {
               datum[k + offset] = "";
             }
           }
           datum[i + offset] = m[j].getParameterValue();
           ht.put(mod, datum);
         }
       }
     }
     return new ArrayList(ht.values());
   }
   return null;
 }
Ejemplo n.º 4
0
  /** Add a Log space. */
  void setLogSpace(String logSpaceName, String dirPath) {

    if (logSpaceName != null && dirPath != null) {
      String[] dirPaths = new String[1];
      dirPaths[0] = dirPath;
      logSpaceList.put(logSpaceName, dirPaths);
    }
  }
Ejemplo n.º 5
0
  private static void addParams(
      Vector paramlist,
      String fsName,
      float totalVal,
      float usedVal,
      float freeVal,
      String capacity,
      String mountFS) {

    for (Enumeration en = logSpaceList.keys(); en.hasMoreElements(); ) {
      String logSpaceName = (String) en.nextElement();
      String[] logDirList = (String[]) logSpaceList.get(logSpaceName);
      for (int i = 0; i < logDirList.length; i++) {
        String logDirPath = logDirList[i];

        // Get actual filesystem name for the directory
        String fs = (String) filesystemMap.get(logDirPath) + "/";

        if (fs != null && fs.equals(mountFS)) {
          String modifier = logSpaceName + "=" + logDirPath;
          paramlist.addElement(
              new PmMeasurement(
                  DIRPATHUSEDSPACENAME,
                  String.valueOf(getDirDiskSpace(logDirPath)),
                  true,
                  modifier));
          paramlist.addElement(new PmMeasurement(FILESYSTEMNAME, fsName, true, modifier));
          paramlist.addElement(
              new PmMeasurement(TOTALSPACENAME, String.valueOf(totalVal), true, modifier));
          paramlist.addElement(
              new PmMeasurement(USEDSPACENAME, String.valueOf(usedVal), true, modifier));
          paramlist.addElement(
              new PmMeasurement(AVAILSPACENAME, String.valueOf(freeVal), true, modifier));
          paramlist.addElement(new PmMeasurement(USEDCAPACITYNAME, capacity, true, modifier));
        }
      }
    }
  }
Ejemplo n.º 6
0
  /** Add a Log space. */
  void setLogSpace(String logSpaceName, String[] dirPaths) {

    if (logSpaceName != null && dirPaths != null) {
      logSpaceList.put(logSpaceName, dirPaths);
    }
  }