示例#1
0
        private static int getMatchingArchiveIndex(RrdDb rrd1, int arcIndex, RrdDb rrd2)
        {
            Archive   archive   = rrd1.getArchive(arcIndex);
            ConsolFun consolFun = archive.getConsolFun();
            int       steps     = archive.getSteps();

            try
            {
                return(rrd2.getArcIndex(consolFun, steps));
            }
            catch (ArgumentException e)
            {
                return(-1);
            }
        }
示例#2
0
文件: RrdDb.cs 项目: mujing/rrd4net
 private static int getMatchingArchiveIndex(RrdDb rrd1, int arcIndex, RrdDb rrd2)
 {
    Archive archive = rrd1.getArchive(arcIndex);
    ConsolFun consolFun = archive.getConsolFun();
    int steps = archive.getSteps();
    try
    {
       return rrd2.getArcIndex(consolFun, steps);
    }
    catch (ArgumentException e)
    {
       return -1;
    }
 }
示例#3
0
文件: Model.cs 项目: mujing/rrd4net
      public FetchData GetArchiveData(DatabaseData databaseData, string dataSourceName, ArcDef archiveDefinition)
      {
         RrdDb database = null;
         try
         {
            database = new RrdDb(databaseData.Definition.getPath(), true);
            int datasourceIndex = database.getDsIndex(dataSourceName);
            Archive archive = database.getArchive(new ConsolFun(archiveDefinition.getConsolFun().Name), archiveDefinition.Steps);
            Robin robin = archive.getRobin(datasourceIndex);
            double[] values = robin.getValues();
            DateTime archiveStartTime = archive.getStartDateTime();
            TimeSpan tick = new TimeSpan(archive.getArcStep() * TimeSpan.TicksPerSecond);

            FetchData fetchedData = new FetchData(archive.getArcStep(), archive.getEndTime(), new string[] { dataSourceName });
            long[] timestamps = new long[archive.getRows()];
            long offset = archive.getStartTime();
            for (var i = 0; i < archive.getRows(); i++)
            {
               timestamps[i] = offset;
               offset += archive.getArcStep();
            }
            fetchedData.setTimestamps(timestamps);
            double[][] value = new double[1][];
            value[0] = values;
            fetchedData.setValues(value);
            return fetchedData;

         }
         finally
         {
            if (database != null)
               database.close();
         }
      }