private final Iterator<IntDoubleCursor> g_iter = g_map.iterator();
/** * OperatorStats merger - to merge stats from other OperatorStats * this is needed in case some processing is multithreaded that needs to have * separate OperatorStats to deal with * WARN - this will only work for metrics that can be added * @param from - OperatorStats from where to merge to "this" * @return OperatorStats - for convenience so one can merge multiple stats in one go */ public OperatorStats mergeMetrics(OperatorStats from) { final IntLongHashMap fromMetrics = from.longMetrics; final Iterator<IntLongCursor> iter = fromMetrics.iterator(); while (iter.hasNext()) { final IntLongCursor next = iter.next(); longMetrics.putOrAdd(next.key, next.value, next.value); } final IntDoubleHashMap fromDMetrics = from.doubleMetrics; final Iterator<IntDoubleCursor> iterD = fromDMetrics.iterator(); while (iterD.hasNext()) { final IntDoubleCursor next = iterD.next(); doubleMetrics.putOrAdd(next.key, next.value, next.value); } return this; }
/** * OperatorStats merger - to merge stats from other OperatorStats * this is needed in case some processing is multithreaded that needs to have * separate OperatorStats to deal with * WARN - this will only work for metrics that can be added * @param from - OperatorStats from where to merge to "this" * @return OperatorStats - for convenience so one can merge multiple stats in one go */ public OperatorStats mergeMetrics(OperatorStats from) { final IntLongHashMap fromMetrics = from.longMetrics; final Iterator<IntLongCursor> iter = fromMetrics.iterator(); while (iter.hasNext()) { final IntLongCursor next = iter.next(); longMetrics.putOrAdd(next.key, next.value, next.value); } final IntDoubleHashMap fromDMetrics = from.doubleMetrics; final Iterator<IntDoubleCursor> iterD = fromDMetrics.iterator(); while (iterD.hasNext()) { final IntDoubleCursor next = iterD.next(); doubleMetrics.putOrAdd(next.key, next.value, next.value); } return this; }