コード例 #1
0
ファイル: CascadingJob.java プロジェクト: s16systems/ambrose
  /**
   * helper method for counter group map retrieval
   *
   * @param HadoopStepStats
   * @return a map of counter name to counter value
   */
  private Map<String, Long> counterGroupInfoMapHelper(HadoopStepStats stats) {
    Counters counters = new Counters();
    Map<String, Long> counterNameToValue = new HashMap<String, Long>();
    for (String groupName : stats.getCounterGroups()) { // retreiving groups
      for (String counterName :
          stats.getCountersFor(groupName)) { // retreiving counters in that group
        Long counterValue = stats.getCounterValue(groupName, counterName);
        counterNameToValue.put(groupName + "::" + counterName, counterValue);

        // creating counter
        Counter counter = counters.findCounter(groupName, counterName);
        counter.setValue(counterValue);
      }
    }
    setCounterGroupMap(CounterGroup.counterGroupInfoMap(counters));
    return counterNameToValue;
  }