internal void AddResult(PerfTestRun run, Hashtable resultDatas, int index) { foreach(PerfResult result in run.Results) { double[] data = (double[])resultDatas[result.TestedType]; data[index] = Math.Log(result.Duration); } foreach(PerfFailedResult failedResult in run.FailedResults) { double[] data = (double[])resultDatas[failedResult.TestedType]; data[index] = 0; } }
/// <summary> /// Default constructor - initializes all fields to default values /// </summary> public PerfTestRunEventArgs(PerfTestRun run) { if (run==null) throw new ArgumentNullException("run"); this.run = run; }
protected void OnStartRun(PerfTestRun run) { if (this.StartRun!=null) this.StartRun(this, new PerfTestRunEventArgs(run)); }
protected void OnFinishRun(PerfTestRun run) { if (this.FinishRun!=null) this.FinishRun(this, new PerfTestRunEventArgs(run)); }
public PerfTestSuite RunTests() { PerfTestSuite suite = new PerfTestSuite(this.TesterType, this.Description, this.FeatureDescription); foreach(MethodInfo test in this.methods) { PerfTest testResult = new PerfTest(test); if (testResult.IsIgnored) { OnIgnoredTest(testResult); suite.Tests.Add(testResult); continue; } OnStartTest(testResult); for(int testIndex = 0;testIndex<this.TestCount;++testIndex) { PerfTestRun run = new PerfTestRun(RunDescription(testIndex)); OnStartRun(run); // for each instanced type, foreach(Type t in this.testedTypes) { try { //jitting if first run of the test if (testIndex==0) RunTest(-1,t,test,false); // calling RunTest(testIndex,t,test,true); // save results run.Results.Add(new PerfResult(t,this.timer.Duration,this.memorizer.Usage)); } catch(Exception ex) { run.FailedResults.Add(new PerfFailedResult(t,ex)); } } OnFinishRun(run); testResult.Runs.Add(run); } OnFinishTest(testResult); suite.Tests.Add(testResult); } return suite; }
public PerfTestSuite RunTests() { PerfTestSuite suite = new PerfTestSuite(this.TesterType, this.Description, this.FeatureDescription); for (int testIndex = 0; testIndex < this.methods.Count;testIndex++) { MethodInfo test = methods[testIndex]; PerfTest testResult = new PerfTest(test); //Adding from the start suite.Tests.Add(testResult); if (testResult.IsIgnored) { OnIgnoredTest(testResult); suite.Tests.Add(testResult); continue; } OnStartTest(testResult); for (int runIndex = 0; runIndex < this.TestCount; ++runIndex) { PerfTestRun run = new PerfTestRun(IsRunDescriptorValueOveridden ? TestStart + runIndex * TestStep : RunDescription(runIndex)); OnStartRun(run); // for each instanced type, foreach (Type t in this.testedTypes) { try { //jitting if first run of the test if (runIndex == 0) RunTest(-1, t, test, false); // calling RunTest(runIndex, t, test, true); // save results run.Results.Add(new PerfResult(t, this.timer.Duration, this.memorizer.Usage)); } catch (Exception ex) { run.FailedResults.Add(new PerfFailedResult(t, ex)); } } OnFinishRun(run); testResult.Runs.Add(run); //Adding to suite suite.Tests[testIndex] = testResult; //Invoking Event Handler OnResultsChange(this, new ResultsChangeEventArgs(suite)); } OnFinishTest(testResult); //suite.Tests[testIndex] = testResult; } return suite; }