public static void RunAnalysesParallel(AFElement element, List<AFTime> aftimes, int analysesThreadCount, ConcurrentQueue<List<AFValue>> dataQueue)
        {
            // for each analyse configured for our element
            Parallel.ForEach(element.Analyses, new ParallelOptions() { MaxDegreeOfParallelism = analysesThreadCount }, (afAnalysis) =>
            {
                TimeSpan evaluationTime;
                int evaluationErrorsCount;
                var analysisRunner = new AnalysisRunner(Configuration.EnableAnalysisErrorOutput);

                var results = analysisRunner.Run(afAnalysis, aftimes, out evaluationTime, out evaluationErrorsCount);

                string prettyElementName = element.Parent != null ? string.Format("{0}\\{1}", element.Parent.Name, element.Name) : element.Name;
                var stats = new StatisticsInfo()
                {
                    AnalyseName = afAnalysis.Name,
                    Duration = evaluationTime,
                    ElementName = prettyElementName,
                    EvaluationsCount = aftimes.Count,
                    EvaluationsErrorCount = evaluationErrorsCount

                };

                // we add statistics to the queue
                Statistics.StatisticsQueue.Add(stats);

                // send data to queue
                if (dataQueue != null)
                {
                    dataQueue.Enqueue(results);
                }

            });
        }
Beispiel #2
0
        public static void RunAnalysesParallel(AFElement element, List <AFTime> aftimes, int analysesThreadCount, ConcurrentQueue <List <AFValue> > dataQueue)
        {
            // for each analyse configured for our element
            Parallel.ForEach(element.Analyses, new ParallelOptions()
            {
                MaxDegreeOfParallelism = analysesThreadCount
            }, (afAnalysis) =>
            {
                TimeSpan evaluationTime;
                int evaluationErrorsCount;
                var analysisRunner = new AnalysisRunner(Configuration.EnableAnalysisErrorOutput);

                var results = analysisRunner.Run(afAnalysis, aftimes, out evaluationTime, out evaluationErrorsCount);

                string prettyElementName = element.Parent != null ? string.Format("{0}\\{1}", element.Parent.Name, element.Name) : element.Name;
                var stats = new StatisticsInfo()
                {
                    AnalyseName           = afAnalysis.Name,
                    Duration              = evaluationTime,
                    ElementName           = prettyElementName,
                    EvaluationsCount      = aftimes.Count,
                    EvaluationsErrorCount = evaluationErrorsCount
                };

                // we add statistics to the queue
                Statistics.StatisticsQueue.Add(stats);

                // send data to queue
                if (dataQueue != null)
                {
                    dataQueue.Enqueue(results);
                }
            });
        }