Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rowIndex"></param>
        /// <returns></returns>
        public FetchPoint GetRow(int rowIndex)
        {
            int        numCols = ColumnCount;
            FetchPoint point   = new FetchPoint(timestamps[rowIndex], ColumnCount);

            for (int dsIndex = 0; dsIndex < numCols; dsIndex++)
            {
                point.SetValue(dsIndex, values[dsIndex][rowIndex]);
            }
            return(point);
        }
Ejemplo n.º 2
0
        internal FetchPoint[] Fetch(FetchRequest request)
        {
            if (request.Filter != null)
            {
                throw new RrdException("Fetch() method does not support filtered datasources." +
                                       " Use fetchData() to get filtered fetch data.");
            }

            long arcStep    = ArcStep;
            long fetchStart = Util.Normalize(request.FetchStart, arcStep);
            long fetchEnd   = Util.Normalize(request.FetchEnd, arcStep);

            if (fetchEnd < request.FetchEnd)
            {
                fetchEnd += arcStep;
            }
            long startTime = StartTime;
            long endTime   = EndTime;
            int  dsCount   = robins.Length;
            int  ptsCount  = (int)((fetchEnd - fetchStart) / arcStep + 1);

            FetchPoint[] points = new FetchPoint[ptsCount];
            for (int i = 0; i < ptsCount; i++)
            {
                long       time  = fetchStart + i * arcStep;
                FetchPoint point = new FetchPoint(time, dsCount);
                if (time >= startTime && time <= endTime)
                {
                    int robinIndex = (int)((time - startTime) / arcStep);
                    for (int j = 0; j < dsCount; j++)
                    {
                        point.SetValue(j, robins[j].GetValue(robinIndex));
                    }
                }
                points[i] = point;
            }
            return(points);
        }