示例#1
0
		// 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);
			}
		}
示例#2
0
		internal Header(RrdDb parentDb, RrdDef rrdDef)
		{
			bool shouldInitialize = rrdDef != null;
			this.parentDb = parentDb;
			signature = new RrdString(this); // NOT constant, may NOT be cached
			step = new RrdLong(this, true); // constant, may be cached
			dsCount = new RrdInt(this, true); // constant, may be cached
			arcCount = new RrdInt(this, true); // constant, may be cached
			lastUpdateTime = new RrdLong(this);
			if (shouldInitialize)
			{
				signature.Set(DEFAULT_SIGNATURE);
				step.Set(rrdDef.Step);
				dsCount.Set(rrdDef.DataSourceDefinitions.Length);
				arcCount.Set(rrdDef.ArchiveDefinitions.Length);
				lastUpdateTime.Set(rrdDef.StartTime);
			}
		}