Beispiel #1
0
        public Header(RrdDb parentDb, DataImporter reader)
            : this(parentDb, (RrdDef)null)
        {
            String version = reader.getVersion();

            if (RRDTOOL_VERSION.CompareTo(version) != 0)
            {
                throw new ArgumentException("Could not unserialize xml version " + version);
            }
            signature.set(DEFAULT_SIGNATURE);
            step.set(reader.getStep());
            dsCount.set(reader.getDsCount());
            arcCount.set(reader.getArcCount());
            lastUpdateTime.set(reader.getLastUpdateTime());
        }
Beispiel #2
0
 public Datasource(RrdDb parentDb, DsDef dsDef)
 {
     bool shouldInitialize = dsDef != null;
     this.parentDb = parentDb;
     dsName = new RrdString(this);
     dsTypeName = new RrdString(this);
     if (!shouldInitialize) 
        dsType = new DsType(dsTypeName.get());
     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.getDsName());
         dsType = dsDef.getDsType();
         dsTypeName.set(dsType.Name);
         heartbeat.set(dsDef.getHeartbeat());
         minValue.set(dsDef.getMinValue());
         maxValue.set(dsDef.getMaxValue());
         lastValue.set(Double.NaN);
         accumValue.set(0.0);
         Header header = parentDb.getHeader();
         nanSeconds.set(header.getLastUpdateTime() % header.getStep());
     }
 }
Beispiel #3
0
        public Datasource(RrdDb parentDb, DsDef dsDef)
        {
            bool shouldInitialize = dsDef != null;

            this.parentDb = parentDb;
            dsName        = new RrdString(this);
            dsTypeName    = new RrdString(this);
            if (!shouldInitialize)
            {
                dsType = new DsType(dsTypeName.get());
            }
            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.getDsName());
                dsType = dsDef.getDsType();
                dsTypeName.set(dsType.Name);
                heartbeat.set(dsDef.getHeartbeat());
                minValue.set(dsDef.getMinValue());
                maxValue.set(dsDef.getMaxValue());
                lastValue.set(Double.NaN);
                accumValue.set(0.0);
                Header header = parentDb.getHeader();
                nanSeconds.set(header.getLastUpdateTime() % header.getStep());
            }
        }
Beispiel #4
0
 public Archive(RrdDb parentDb, ArcDef arcDef)
 {
    bool shouldInitialize = arcDef != null;
    this.parentDb = parentDb;
    consolFun = new RrdString(this, true);  // constant, may be cached
    xff = new RrdDouble(this);
    steps = new RrdInt(this, true);            // constant, may be cached
    rows = new RrdInt(this, true);            // constant, may be cached
    if (shouldInitialize)
    {
       consolFun.set(arcDef.getConsolFun().Name);
       xff.set(arcDef.getXff());
       steps.set(arcDef.getSteps());
       rows.set(arcDef.getRows());
    }
    int n = parentDb.getHeader().getDsCount();
    states = new ArcState[n];
    robins = new Robin[n];
    for (int i = 0; i < n; i++)
    {
       states[i] = new ArcState(this, shouldInitialize);
       int numRows = rows.get();
       robins[i] = new Robin(this, numRows, shouldInitialize);
    }
 }
Beispiel #5
0
        public Archive(RrdDb parentDb, ArcDef arcDef)
        {
            bool shouldInitialize = arcDef != null;

            this.parentDb = parentDb;
            consolFun     = new RrdString(this, true); // constant, may be cached
            xff           = new RrdDouble(this);
            steps         = new RrdInt(this, true);    // constant, may be cached
            rows          = new RrdInt(this, true);    // constant, may be cached
            if (shouldInitialize)
            {
                consolFun.set(arcDef.getConsolFun().Name);
                xff.set(arcDef.getXff());
                steps.set(arcDef.getSteps());
                rows.set(arcDef.getRows());
            }
            int n = parentDb.getHeader().getDsCount();

            states = new ArcState[n];
            robins = new Robin[n];
            for (int i = 0; i < n; i++)
            {
                states[i] = new ArcState(this, shouldInitialize);
                int numRows = rows.get();
                robins[i] = new Robin(this, numRows, shouldInitialize);
            }
        }
Beispiel #6
0
 public Datasource(RrdDb parentDb, DataImporter reader, int dsIndex)
     : this(parentDb, null)
 {
     dsName.set(reader.getDsName(dsIndex));
     dsType = new DsType(reader.getDsType(dsIndex));
     dsTypeName.set(dsType.Name);
     heartbeat.set(reader.getHeartbeat(dsIndex));
     minValue.set(reader.getMinValue(dsIndex));
     maxValue.set(reader.getMaxValue(dsIndex));
     lastValue.set(reader.getLastValue(dsIndex));
     accumValue.set(reader.getAccumValue(dsIndex));
     nanSeconds.set(reader.getNanSeconds(dsIndex));
 }
Beispiel #7
0
        public Header(RrdDb parentDb, RrdDef rrdDef, String initSignature)
        {
            this.parentDb = parentDb;

            signature = new RrdString(this);	 		// NOT constant, may 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 (rrdDef != null)
            {
                signature.set(initSignature);
                step.set(rrdDef.getStep());
                dsCount.set(rrdDef.getDsCount());
                arcCount.set(rrdDef.getArcCount());
                lastUpdateTime.set(rrdDef.getStartTime());
            }
        }
Beispiel #8
0
        public Header(RrdDb parentDb, RrdDef rrdDef, String initSignature)
        {
            this.parentDb = parentDb;

            signature      = new RrdString(this);               // NOT constant, may 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 (rrdDef != null)
            {
                signature.set(initSignature);
                step.set(rrdDef.getStep());
                dsCount.set(rrdDef.getDsCount());
                arcCount.set(rrdDef.getArcCount());
                lastUpdateTime.set(rrdDef.getStartTime());
            }
        }