/// <summary> /// Reports the results of a single timing run. /// </summary> /// <param name="args">The shared arguments for timing information.</param> public void EndTimingMethod(TimingResultsArgs args) { listeners.ForEach(sl => sl.EndTimingMethod(args)); }
/// <summary> /// Reports that a method is beginning its timing run. /// The same argument object is used for the start and end, but the /// Time will not be populated until the EndTimingMethod call. /// </summary> /// <param name="args">The shared arguments for timing information.</param> public void StartTimingMethod(TimingResultsArgs args) { listeners.ForEach(sl => sl.StartTimingMethod(args)); }
/// <summary> /// Reports the results of a single timing run. /// </summary> /// <param name="args">The shared arguments for timing information.</param> public void EndTimingMethod(TimingResultsArgs args) { Console.WriteLine(" Info: {2} = {0} at {1} iterations", args.Method, args.Iterations, args.Time); }
/// <summary> /// Reports that a method is beginning its timing run. /// The same argument object is used for the start and end, but the /// Time will not be populated until the EndTimingMethod call. /// </summary> /// <param name="args">The shared arguments for timing information.</param> public void StartTimingMethod(TimingResultsArgs args) { }
/// <summary> /// Runs the unit performance in the fixture. /// </summary> private void RunTimingMethods() { // Go through the performance tests. foreach (MethodRunner methodRunner in methods) { // Go through the iterations for the performance. foreach (int iteration in methodRunner.TimingAttribute.Iterations) { // Get the time to run the baseline. The normal baseline will probably be // zero, but the user may give a longer-running one. TimeSpan baselineTime = GetBaselineExecutionTime(methodRunner.MethodSignature, iteration); // Report that we are starting to run the timing. var timingResults = new TimingResultsArgs { Iterations = iteration, Method = methodRunner.Method, BaselineTime = baselineTime, }; Runner.StatusListener.StartTimingMethod(timingResults); TimeSpan methodTime = methodRunner.GetExecutionTime(iteration); // Report the results of the timing. timingResults.Time = (methodTime - baselineTime); runner.StatusListener.EndTimingMethod(timingResults); } } }