public void CreateRanges(int[] secRanges, FlushCB f = null) { currentRanges = new StatRange[secRanges.Length]; lastRanges = new StatRange[secRanges.Length]; for (int i = 0; i < secRanges.Length; i++) { lastRanges[i] = currentRanges[i] = new StatRange(secRanges[i]); } flushCallback = f; }
public void CreateRanges(int[] secRanges, MongoRange[] pranges, FlushCB f = null) { currentRanges = new StatRange[secRanges.Length]; lastRanges = new StatRange[secRanges.Length]; for (int i = 0; i < secRanges.Length; i++) { StatRange sr = new StatRange(secRanges[i]); for (int j = 0; j < pranges.Length; j++) { if (pranges[j].SecondsInterval == secRanges[i]) { sr.Restore(pranges[j]); break; } } lastRanges[i] = currentRanges[i] = sr; } flushCallback = f; }
public StatRange(StatRange prev) : this(prev.secondsInterval, prev.NextLeft) { }
private StatRange FlushExpired(int i, StatRange r) { if (r.Expired) { // flush and create new if (flushCallback != null) flushCallback(r, this.MatchData); logger.Info("{0} {1}/{2}sec.", matchString(), r.Counter, r.secondsInterval); lastRanges[i] = r; r = currentRanges[i] = new StatRange(r); } return r; }