コード例 #1
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));
        }