public AbstractCounters(Org.Apache.Hadoop.Mapreduce.Counters.AbstractCounters <C1, G1> counters, CounterGroupFactory <C, G> groupFactory) { this.groupFactory = groupFactory; foreach (G1 group in counters) { string name = group.GetName(); G newGroup = groupFactory.NewGroup(name, group.GetDisplayName(), limits); (CounterGroupFactory.IsFrameworkGroup(name) ? fgroups : groups)[name] = newGroup; foreach (Counter counter in group) { newGroup.AddCounter(counter.GetName(), counter.GetDisplayName(), counter.GetValue ()); } } }
/// <summary> /// Increments multiple counters by their amounts in another Counters /// instance. /// </summary> /// <param name="other">the other Counters instance</param> public virtual void IncrAllCounters(Org.Apache.Hadoop.Mapreduce.Counters.AbstractCounters <C, G> other) { lock (this) { foreach (G right in other) { string groupName = right.GetName(); G left = (CounterGroupFactory.IsFrameworkGroup(groupName) ? fgroups : groups)[groupName ]; if (left == null) { left = AddGroup(groupName, right.GetDisplayName()); } left.IncrAllCounters(right); } } }