Exemple #1
0
        /// <summary>
        /// Executes the task
        /// </summary>
        /// <param name="task">The task to run</param>
        /// <param name="settings">The settings for the profiler</param>
        /// <returns>The resulting collection of the executions</returns>
        public virtual IProfilerResult Execute(ITask task, ProfilerSettings settings)
        {
            if (_next == null)
            {
                return(new ProfilerResult());
            }

            return(_next.Execute(task, settings));
        }
Exemple #2
0
        /// <summary>
        /// Starts the profiling session
        /// </summary>
        /// <returns>The resulting profile</returns>
        public IProfilerResult RunSession()
        {
            if (_task == null)
            {
                throw new ArgumentException($"The Task that has to be processed is null or not set.");
            }

            if (_settings.RunWarmup)
            {
                _sessionPipeline.SetNext(new WarmupSessionHandler());
            }

            _sessionPipeline.SetNext(_executor);

            _processingPipeline.SetNext(new ProcessDataTaskHandler());
            _processingPipeline.SetNext(new MemoryCollectionTaskHandler());
            _processingPipeline.SetNext(new ElapsedTimeTaskHandler());
            _processingPipeline.SetNext(_task);

            var threads = _executor is MultyThreadSessionHandler handler ? handler.ThreadCount : 1;

            System.Diagnostics.Trace.WriteLine($"MeasureMap - Running {Settings.Iterations} Iterations on {threads} Threads");

            var profiles = _sessionPipeline.Execute(_processingPipeline, _settings);

            foreach (var condition in _assertions)
            {
                foreach (var profile in profiles)
                {
                    if (!condition(profile))
                    {
                        throw new AssertionException($"Condition failed: {condition}");
                    }
                }
            }

            return(profiles);
        }
Exemple #3
0
 /// <summary>
 /// Executes the task
 /// </summary>
 /// <param name="task">The task to run</param>
 /// <param name="settings">The settings for the profiler</param>
 /// <returns>The resulting collection of the executions</returns>
 public IProfilerResult Execute(ITask task, ProfilerSettings settings)
 {
     return(_root.Execute(task, settings));
 }