예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is RrdDb))
            {
                throw new RrdException("Cannot copy RrdDb object to " + other.ToString());
            }
            RrdDb otherRrd = (RrdDb)other;

            header.CopyStateTo(otherRrd.header);
            for (int i = 0; i < datasources.Length; i++)
            {
                int j = Util.GetMatchingDatasourceIndex(this, i, otherRrd);
                if (j >= 0)
                {
                    datasources[i].CopyStateTo(otherRrd.datasources[j]);
                }
            }
            for (int i = 0; i < archives.Length; i++)
            {
                int j = Util.GetMatchingArchiveIndex(this, i, otherRrd);
                if (j >= 0)
                {
                    archives[i].CopyStateTo(otherRrd.archives[j]);
                }
            }
        }
예제 #2
0
 internal Sample(RrdDb parentDb, long time)
 {
     this.parentDb = parentDb;
     this.time     = time;
     this.dsNames  = parentDb.DsNames;
     values        = new double[dsNames.Length];
     ClearCurrentValues();
 }
예제 #3
0
 internal Header(RrdDb parentDb, RrdDef rrdDef)
 {
     this.parentDb  = parentDb;
     signature      = new RrdString(SIGNATURE, this);
     step           = new RrdLong(rrdDef.Step, this);
     dsCount        = new RrdInt(rrdDef.DsCount, this);
     arcCount       = new RrdInt(rrdDef.ArcCount, this);
     lastUpdateTime = new RrdLong(rrdDef.StartTime, this);
 }
예제 #4
0
 internal FetchRequest(RrdDb parentDb, string consolFun, long fetchStart, long fetchEnd, long resolution)
 {
     this.parentDb   = parentDb;
     this.consolFun  = consolFun;
     this.fetchStart = fetchStart;
     this.fetchEnd   = fetchEnd;
     this.resolution = resolution;
     Validate();
 }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentDb"></param>
 public Datasource(RrdDb parentDb)
 {
     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);
 }
예제 #6
0
        internal static int GetMatchingDatasourceIndex(RrdDb rrd1, int dsIndex, RrdDb rrd2)
        {
            string dsName = rrd1.GetDatasource(dsIndex).DsName;

            try
            {
                return(rrd2.GetDsIndex(dsName));
            }
            catch (RrdException)
            {
                return(-1);
            }
        }
예제 #7
0
 internal Header(RrdDb parentDb)
 {
     this.parentDb = parentDb;
     signature     = new RrdString(this);
     if (!signature.Get().Equals(SIGNATURE))
     {
         throw new RrdException("Not an RRDSharp file");
     }
     step           = new RrdLong(this);
     dsCount        = new RrdInt(this);
     arcCount       = new RrdInt(this);
     lastUpdateTime = new RrdLong(this);
 }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parentDb"></param>
        /// <param name="dsDef"></param>
        public Datasource(RrdDb parentDb, DsDef dsDef)
        {
            this.parentDb = parentDb;
            dsName        = new RrdString(dsDef.DsName, this);
            dsType        = new RrdString(dsDef.DsType, this);
            heartbeat     = new RrdLong(dsDef.Heartbeat, this);
            minValue      = new RrdDouble(dsDef.MinValue, this);
            maxValue      = new RrdDouble(dsDef.MaxValue, this);
            lastValue     = new RrdDouble(Double.NaN, this);
            accumValue    = new RrdDouble(0.0, this);
            Header header = parentDb.Header;

            nanSeconds = new RrdLong(header.LastUpdateTime % header.Step, this);
        }
예제 #9
0
        internal static int GetMatchingArchiveIndex(RrdDb rrd1, int arcIndex, RrdDb rrd2)
        {
            Archive archive   = rrd1.GetArchive(arcIndex);
            string  consolFun = archive.ConsolFun;
            int     steps     = archive.Steps;

            try
            {
                return(rrd2.GetArcIndex(consolFun, steps));
            }
            catch (RrdException)
            {
                return(-1);
            }
        }
예제 #10
0
        /// <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());
            }
        }