For chart apis they prefer a mapping of data from multiple arrays. for example.. [Metric1, M2, M3, ...], [M1.Result, M2.Result, M3.Result, ...], [Time1 - Time2, T2-T3, T3-T4, ...]
Esempio n. 1
0
        public MetricResult RunAlternativeEngine(DateTime start, DateTime end, TimeSpan timeInterval)
        {
            dataEngine.SetDataEngine(@"C:\Users\t-hawkf\Desktop\Logs\W3SVC1");
            MetricResult metricResults = new MetricResult();

            MakeNewMetricCollection();
            //Thought we are enumerating the data from the parser, the code is less complex if we have it all into a list and then perform our computations. Simple and quicker than the RunEngine method
            //now that we have all of our data in memory go ahead and perform computations on our data with our metrics


            int count = 0;

            while (start < end)
            {
                //if we are going by the hour then add 1 Hour to starttime, by the day then add 1 day to startime, by weekly then add 7 days to starttime, by monthly
                //and by yearly....
                DateTime intermediateTime = start + timeInterval;

                //perform metric computation on all data from [startTime, intermediateTime)
                //afterwards clear the data that are in the metrics and compute metrics for the next set of data
                foreach (W3C_Extended_Log log in dataEngine.GetLines(start, intermediateTime))
                {
                    HelperFunction(start, intermediateTime, log);
                }

                //after HelperFunction is called, the metrics for the data of timestamps [startTime, intermediateTime] should be completed, now organize the data
                foreach (IMetric job in _metricCollection)
                {
                    //make a new object of list for that key
                    if (job != null)
                    {
                        if (!metricResults.MetricNames.Contains(job.MetricName))
                        {
                            metricResults.MetricNames.Add(job.MetricName);
                            metricResults.Result.Add(new List <object>());
                        }
                        if (!metricResults.Times.Contains(start.ToString()))
                        {
                            metricResults.Times.Add(start.ToString());
                        }

                        metricResults.Result[count].Add(job.GetResult());
                        //count keep tracks of which List object we add the result to. Each Metric has its own List object
                        count++;
                    }
                }

                start = intermediateTime;
                MakeNewMetricCollection();
                count = 0;
            }
            return(metricResults);
        }
        public MetricResult RunAlternativeEngine(DateTime start, DateTime end, TimeSpan timeInterval)
        {
            dataEngine.SetDataEngine(@"C:\Users\t-hawkf\Desktop\Logs\W3SVC1");
            MetricResult metricResults = new MetricResult();
            MakeNewMetricCollection();
            //Thought we are enumerating the data from the parser, the code is less complex if we have it all into a list and then perform our computations. Simple and quicker than the RunEngine method
                //now that we have all of our data in memory go ahead and perform computations on our data with our metrics

            int count = 0;
            while (start < end)
            {
                //if we are going by the hour then add 1 Hour to starttime, by the day then add 1 day to startime, by weekly then add 7 days to starttime, by monthly
                //and by yearly....
                DateTime intermediateTime = start + timeInterval;

                //perform metric computation on all data from [startTime, intermediateTime)
                //afterwards clear the data that are in the metrics and compute metrics for the next set of data
                foreach (W3C_Extended_Log log in dataEngine.GetLines(start, intermediateTime))
                {
                    HelperFunction(start, intermediateTime, log);
                }

                //after HelperFunction is called, the metrics for the data of timestamps [startTime, intermediateTime] should be completed, now organize the data
                foreach (IMetric job in _metricCollection)
                {
                    //make a new object of list for that key
                    if (job != null)
                    {
                        if (!metricResults.MetricNames.Contains(job.MetricName))
                        {
                            metricResults.MetricNames.Add(job.MetricName);
                            metricResults.Result.Add(new List<object>());
                        }
                        if (!metricResults.Times.Contains(start.ToString()))
                        {
                            metricResults.Times.Add(start.ToString());
                        }

                        metricResults.Result[count].Add(job.GetResult());
                        //count keep tracks of which List object we add the result to. Each Metric has its own List object
                        count++;
                    }

                }

                start = intermediateTime;
                MakeNewMetricCollection();
                count = 0;

            }
            return metricResults;
        }