public void StartingTwice()
 {
     BenchmarkMonitor monitor = new BenchmarkMonitor();
     Assert.IsFalse(monitor.IsRunning, "status should be not running yet");
     monitor.Start();
     Assert.IsTrue(monitor.IsRunning, "status should now be running yet");
     monitor.Start();
 }
        public void GetResultSample()
        {
            BenchmarkMonitor monitor = new BenchmarkMonitor();
            Assert.IsFalse(monitor.IsRunning, "status should be not running yet");
            Assert.IsNotNull(monitor.Results);
            Assert.AreEqual(0, monitor.Results.Count);

            monitor.Start();
            Assert.IsTrue(monitor.IsRunning, "status should now be running yet");
            Thread.Sleep(TimeSpan.FromSeconds(10));

            monitor.Stop();
            Assert.IsFalse(monitor.IsRunning, "status should no longer be running");
            Assert.IsTrue(monitor.Results.Count > 0);
        }
Beispiel #3
0
        public IEnumerable<ExperimentResult> Run()
        {
            // TODO: add warmup stage

            List<WaitHandle> waitHandles = new List<WaitHandle>();

            BenchmarkMonitor monitor = new BenchmarkMonitor();
            monitor.Start();

            foreach (Experiment experiment in this.experiments)
            {
                experiment.Start();
                waitHandles.Add(experiment.HasFinishedEvent);
            }
            bool finishedInTime = WaitHandle.WaitAll(waitHandles.ToArray(), TimeSpan.FromMinutes(60));
            monitor.Stop();

            List<ExperimentResult> results = new List<ExperimentResult>();
            foreach (Experiment experiment in this.experiments)
            {
                results.Add(experiment.Result);
            }
            return results;
        }