Ejemplo n.º 1
0
        private string[] varNames; // Name of the variable, NOT it's dsName in the file

        #endregion Fields

        #region Constructors

        internal ValueExtractor( string[] names, FetchData[] values )
        {
            this.varNames	= names;

            // Set timestamps
            tPos			= new int[values.Length];
            timestamps 		= new long[values.Length][];
            dsValues		= new double[values.Length][][];

            for (int i = 0; i < timestamps.Length; i++)
            {
                if ( values[i] != null )
                {
                    timestamps[i] 	= values[i].Timestamps;
                    dsValues[i]		= values[i].Values;
                }
            }
        }
Ejemplo n.º 2
0
        internal ValueExtractor Fetch( RrdDb rrd, long startTime, long endTime )
        {
            long rrdStep			= rrd.RrdDef.Step;
            FetchData[] result		= new FetchData[datasources.Length];

            string[] names 			= new string[numSources];
            int tblPos		= 0;

            for (int i = 0; i < datasources.Length; i++)
            {
                if ( datasources[i].Count > 0 )
                {
                    // Set the list of ds names
                    string[] dsNames 	= new string[ datasources[i].Count ];
                    string[] vNames		= new string[ datasources[i].Count ];

                    for (int j = 0; j < dsNames.Length; j++ )
                    {
                        string[] spair	= (string[]) datasources[i][j];
                        dsNames[j]	 	= spair[0];
                        vNames[j]		= spair[1];
                    }

                    // Fetch datasources
                    FetchRequest request 		= rrd.CreateFetchRequest( cfNames[i], startTime, endTime + rrdStep);
                    request.SetFilter(dsNames);

                    FetchData data				= request.FetchData();

                    for (int j = 0; j < vNames.Length; j++)
                        names[ data.GetDsIndex(dsNames[j]) + tblPos ] = vNames[j];
                    tblPos				+= dsNames.Length;

                    result[i]					= data;
                }
            }

            return new ValueExtractor( names, result );
        }