// state variables internal DataSource(RrdDb parentDb, DsDef dsDef) { bool shouldInitialize = dsDef != null; this.parentDb = parentDb; dsName = new RrdString(this); dsType = new RrdString(this); heartbeat = new RrdLong(this); minValue = new RrdDouble(this); maxValue = new RrdDouble(this); lastValue = new RrdDouble(this); accumValue = new RrdDouble(this); nanSeconds = new RrdLong(this); if (shouldInitialize) { dsName.Set(dsDef.Name); primitiveDsName = null; dsType.Set(dsDef.Type.ToString()); primitiveDsType = null; heartbeat.Set(dsDef.Heartbeat); minValue.Set(dsDef.MinValue); maxValue.Set(dsDef.MaxValue); lastValue.Set(Double.NaN); accumValue.Set(0.0); Header header = parentDb.Header; nanSeconds.Set(header.LastUpdateTime%header.Step); } }
internal ArcState(Archive parentArc, bool shouldInitialize) { this.parentArc = parentArc; accumumatedValue = new RrdDouble(this); nanSteps = new RrdLong(this); if (shouldInitialize) { Header header = parentArc.ParentDb.Header; long step = header.Step; long lastUpdateTime = header.LastUpdateTime; long arcStep = parentArc.TimeStep; long initNanSteps = (Util.Normalize(lastUpdateTime, step) - Util.Normalize(lastUpdateTime, arcStep))/step; accumumatedValue.Set(Double.NaN); nanSteps.Set(initNanSteps); } }