Example #1
0
        public override void Run()
        {
            Console.WriteLine("The number of processors on this computer is {0}.", Environment.ProcessorCount);
            this.Parallelism = this.Parallelism == 0 ? Environment.ProcessorCount : Math.Min(this.Parallelism, Environment.ProcessorCount);
            Console.WriteLine("Parallelism to be used in this perf test {0}.", this.Parallelism);
            IEnumerable <string> processortags = Enumerable.Range(0, Parallelism).Select(i => $"{this.Tag}-{i}");

            Statistics stats   = new Statistics();
            object     lockObj = new object();

            Parallel.ForEach(processortags, item =>
            {
                PerfTestStepProvider step = DoWork(item);
                lock (lockObj)
                {
                    stats += step.Stats;
                }
            });

            if (this.Parallelism > 1)
            {
                Console.WriteLine("Overall stats");
                stats.Print();
            }
        }
        public override void Run()
        {
            LiveModel liveModel = Helpers.CreateLiveModelOrExit(this.ConfigPath);
            RLDriver  rlDriver  = new RLDriver(liveModel);

            rlDriver.StepInterval = TimeSpan.FromMilliseconds(this.SleepIntervalMs);
            PerfTestStepProvider stepProvider = new PerfTestStepProvider(this.ActionsCount, this.SharedFeatures, this.ActionFeatures)
            {
                Duration = TimeSpan.FromMilliseconds(this.DurationMs), Tag = this.Tag
            };

            rlDriver.Run(stepProvider);
            stepProvider.Stats.Print();
        }
Example #3
0
        private PerfTestStepProvider DoWork(string tag)
        {
            LiveModel liveModel = Helpers.CreateLiveModelOrExit(this.ConfigPath);

            PerfTestStepProvider stepProvider = new PerfTestStepProvider(this.ActionsCount, this.SharedFeatures, this.ActionFeatures)
            {
                Duration = TimeSpan.FromMilliseconds(this.DurationMs),
                Tag      = tag,
                DataSize = this.DataSize * 1024 * 1024 * 1024 / this.Parallelism
            };

            Console.WriteLine(stepProvider.DataSize);
            RLDriver rlDriver = new RLDriver(liveModel)
            {
                StepInterval = TimeSpan.FromMilliseconds(this.SleepIntervalMs)
            };

            rlDriver.Run(stepProvider);
            stepProvider.Stats.Print();
            return(stepProvider);
        }