protected internal override void starting(Description description) { if (perfTestConfiguration == null) { File file = IoUtil.getFile(PROPERTY_FILE_NAME); if (!file.exists()) { throw new PerfTestException("Cannot load file '" + PROPERTY_FILE_NAME + "': file does not exist."); } FileStream propertyInputStream = null; try { propertyInputStream = new FileStream(file, FileMode.Open, FileAccess.Read); Properties properties = new Properties(); properties.load(propertyInputStream); perfTestConfiguration = new PerfTestConfiguration(properties); } catch (Exception e) { throw new PerfTestException("Cannot load properties from file " + PROPERTY_FILE_NAME + ": " + e); } finally { IoUtil.closeSilently(propertyInputStream); } } }
public ExecutionContext(PerfTestConfiguration configuration) { this.lab = new PerfLab(typeof(StringBuildingTester).Assembly, typeof(StringRunner).Assembly, typeof(Dictionary <,>).Assembly); this.RunTests(); //this.RunSomeTests(); this.perfTestConfiguration = configuration; }
protected internal override void processResults(PerfTestResults results, TabularResultSet tabularResultSet) { PerfTestConfiguration configuration = results.Configuration; IList <string> watchActivities = configuration.WatchActivities; foreach (PerfTestResult passResult in results.PassResults) { string passTitle = getPassTitle(results.TestName, configuration, passResult); TabularResultSet result = processPassResult(watchActivities, passResult); htmlBuilder.addSection(passTitle, result); } }
private void PrepareStart() { this.perfTestConfiguration = new PerfTestConfiguration(Settings.Default.IgnoreFirstRunDueToJITting, Settings.Default.TriggerGCBeforeEachTest); IsStarted = true; foreach (var series in memorySeries.Select(m => m.Value) .Union(speedSeries.Select(s => s.Value))) { series.Points.Clear(); } SpeedPlotModel.RefreshPlot(true); MemoryPlotModel.RefreshPlot(true); }
protected internal virtual IList <object> processRow(PerfTestResult passResult, PerfTestResults results) { IList <object> row = new List <object>(); PerfTestConfiguration configuration = results.Configuration; // test name row.Add(results.TestName); // number of runs int numberOfRuns = configuration.NumberOfRuns; row.Add(numberOfRuns); // database row.Add(configuration.DatabaseName); // history level row.Add(configuration.HistoryLevel); // start time row.Add(configuration.StartTime); // platform row.Add(configuration.Platform); // number of threads row.Add(passResult.NumberOfThreads); // add duration long duration = passResult.Duration; row.Add(duration); // throughput float numberOfRunsFloat = numberOfRuns; float throughput = (numberOfRunsFloat / duration) * 1000; row.Add(throughput); return(row); }
public ChartViewModel(PerfLab lab, TestSuiteInfo suiteInfo) { this.perfTestConfiguration = new PerfTestConfiguration(Settings.Default.IgnoreFirstRunDueToJITting, Settings.Default.TriggerGCBeforeEachTest); this.Title = suiteInfo.TestSuiteDescription; Lab = lab; TestSuiteInfo = suiteInfo; this.StartValue = 1; this.EndValue = suiteInfo.DefaultTestCount; this.StepValue = 1; SpeedPlotModel = new PlotModel(string.Format("\"{0}\": Time characteristics", suiteInfo.TestSuiteDescription)); SpeedPlotModel.Axes.Clear(); SpeedPlotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, suiteInfo.FeatureDescription)); MemoryPlotModel = new PlotModel(string.Format("\"{0}\": Memory usage", suiteInfo.TestSuiteDescription)); MemoryPlotModel.Axes.Clear(); MemoryPlotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, suiteInfo.FeatureDescription)); memorySeries = new Dictionary <TestInfo, LineSeries>(); speedSeries = new Dictionary <TestInfo, LineSeries>(); IsLinear = true; IsStarted = false; var errorHandler = IoC.Instance.Resolve <ErrorHandler>(); var whenStarted = this.WhenAny(x => x.IsStarted, x => x.Value); this.StartSequential = new ReactiveAsyncCommand(whenStarted.Select(x => !x)); StartSequential.RegisterAsyncAction(OnStartSequential, RxApp.DeferredScheduler); errorHandler.HandleErrors(this.StartSequential); this.StartParallel = new ReactiveAsyncCommand(whenStarted.Select(x => !x)); StartParallel.RegisterAsyncAction(OnStartParallel, RxApp.DeferredScheduler); errorHandler.HandleErrors(this.StartParallel); this.Stop = new ReactiveAsyncCommand(whenStarted); Stop.RegisterAsyncAction(OnStop, RxApp.DeferredScheduler); errorHandler.HandleErrors(this.Stop); this.WhenAny(x => x.IsLinear, x => x.Value ? EAxisType.Linear : EAxisType.Logarithmic) .Subscribe(SetAxisType); MessageBus.Current.Listen <PerfTestResult>() .Where(x => tests.FirstOrDefault(t => t.TestId.Equals(x.TestId)) != null) .Subscribe( res => { var nextRes = res as NextResult; var errorRes = res as ExperimentError; if (nextRes != null) { AddPoint(memorySeries, MemoryPlotModel, tests.First(x => x.TestId.Equals(res.TestId)), nextRes.Descriptor, nextRes.MemoryUsage); AddPoint(speedSeries, SpeedPlotModel, tests.First(x => x.TestId.Equals(res.TestId)), nextRes.Descriptor, nextRes.Duration); } if (errorRes != null) { var test = tests.FirstOrDefault(x => x.TestId.Equals(errorRes.TestId)); Task.Factory.StartNew(() => errorHandler.ReportExperimentError(errorRes, test)); } }, errorHandler.ReportException); ConnectIterationAndDescriptors(); }
protected internal virtual string getPassTitle(string testName, PerfTestConfiguration configuration, PerfTestResult passResult) { return(testName + " (Runs: " + configuration.NumberOfRuns + ", Threads: " + passResult.NumberOfThreads + ", Duration: " + passResult.Duration + " ms)"); }
public void SavePerfTestConfigurationToSettings(PerfTestConfiguration configuration) { Settings.Default.IgnoreFirstRunDueToJITting = configuration.IgnoreFirstRunDueToJITting; Settings.Default.TriggerGCBeforeEachTest = configuration.TriggerGCBeforeEachTest; Settings.Default.Save(); }
public TestsTreeView() { this.InitializeComponent(); this.DataContext = RxApp.GetService <ITestsTreeViewModel>(); this.PerfTestConfiguration = this.GetPerfTestConfigurationFromSettings(); }
public void SetPerfTestConfiguration(PerfTestConfiguration configuration) { PerfTestConfigurationTemp = configuration; PerfTestConfiguration = configuration.Clone(); _propertyGrid.SelectedObject = PerfTestConfiguration; }