internal void Store(double newValue) { int position = pointer.Get(); values.Set(position, newValue); pointer.Set((position + 1) % rows); }
internal void archive(int dsIndex, double data, long numUpdates) { Robin robin = robins[dsIndex]; ArcState state = states[dsIndex]; long step = parentDb.Header.Step; long lastUpdateTime = parentDb.Header.LastUpdateTime; long updateTime = Util.Normalize(lastUpdateTime, step) + step; long arcStep = ArcStep; while (numUpdates > 0) { Accumulate(state, data); numUpdates--; if (updateTime % arcStep == 0) { FinalizeStep(state, robin); break; } else { updateTime += step; } } int bulkUpdateCount = (int)Math.Min(numUpdates / steps.Get(), (long)rows.Get()); robin.BulkStore(data, bulkUpdateCount); long remainingUpdates = numUpdates % steps.Get(); for (long i = 0; i < remainingUpdates; i++) { Accumulate(state, data); } }
/// <summary> /// /// </summary> /// <param name="parentDb"></param> public Archive(RrdDb parentDb) { this.parentDb = parentDb; consolFun = new RrdString(this); xff = new RrdDouble(this); steps = new RrdInt(this); rows = new RrdInt(this); int n = parentDb.Header.DsCount; states = new ArcState[n]; robins = new Robin[n]; for (int i = 0; i < n; i++) { states[i] = new ArcState(this); robins[i] = new Robin(this, rows.Get()); } }