/// <summary>Runs all public benchmark methods (static and nonstatic) in the /// specified object ('set') and prints results to the console. Each method /// is run the number of times indicated by the Trials attribute of /// BenchmarkAttribute (if provided) or DefaultNumTrials.</summary> public void RunPublicBenchmarksInConsole(object subject, bool randomOrder, string prefix = null, bool clearOldResults = true) { #if CompactFramework // Console cursor cannot be controlled in the Compact Framework var t = new SimpleTimer(); RunPublicBenchmarks(subject, randomOrder, () => { // Also, console printing is slow; avoid spending too much time on it if (t.ClearAfter(10000) != 0) { PrintResults(Console.Out); t.Restart(); } }, prefix, clearOldResults); PrintResults(Console.Out); #else int end = Console.CursorTop; RunPublicBenchmarks(subject, randomOrder, () => { int start = Console.CursorTop; PrintResults(Console.Out); end = Console.CursorTop; Console.CursorTop = start; }, prefix, clearOldResults); Console.CursorTop = end; #endif }