|
1 | | -using BenchmarkDotNet.Attributes; |
2 | | -using BenchmarkDotNet.Configs; |
3 | | -using BenchmarkDotNet.Diagnosers; |
| 1 | +using BenchmarkDotNet.Configs; |
4 | 2 | using BenchmarkDotNet.Engines; |
5 | 3 | using BenchmarkDotNet.Exporters; |
| 4 | +using BenchmarkDotNet.Extensions; |
6 | 5 | using BenchmarkDotNet.Loggers; |
7 | | -using BenchmarkDotNet.Reports; |
8 | 6 | using BenchmarkDotNet.Running; |
9 | 7 | using System; |
10 | | -using System.Collections.Generic; |
11 | 8 | using System.Linq; |
12 | 9 |
|
13 | 10 | namespace BenchmarkDotNet.Samples; |
@@ -49,37 +46,13 @@ public static int Main(string[] args) |
49 | 46 | args = args.Where(x => x != "--inProcess").ToArray(); |
50 | 47 |
|
51 | 48 | DebugConfig config = isInProcess |
52 | | - ? new DebugInProcessConfig() |
53 | | - : new DebugBuildConfig(); |
| 49 | + ? new DebugInProcessConfig() |
| 50 | + : new DebugBuildConfig(); |
54 | 51 |
|
55 | 52 | return config.AddAnalyser(DefaultConfig.Instance.GetAnalysers().ToArray()) |
56 | | - .AddDiagnoser( |
57 | | - MemoryDiagnoser.Default, |
58 | | -#if NETCOREAPP3_0_OR_GREATER |
59 | | - new ThreadingDiagnoser(new ThreadingDiagnoserConfig(displayCompletedWorkItemCountWhenZero: false, displayLockContentionWhenZero: false)), |
| 53 | + .AddExporter(MarkdownExporter.Default) |
| 54 | + .AddValidator(DefaultConfig.Instance.GetValidators().ToArray()) |
| 55 | + .WithArtifactsPath(DefaultConfig.Instance.ArtifactsPath); |
60 | 56 | #endif |
61 | | - new ExceptionDiagnoser(new ExceptionDiagnoserConfig(displayExceptionsIfZeroValue: false)) |
62 | | - ) |
63 | | - .AddExporter(MarkdownExporter.Default) |
64 | | - .AddValidator(DefaultConfig.Instance.GetValidators().ToArray()) |
65 | | - .WithArtifactsPath(DefaultConfig.Instance.ArtifactsPath); |
66 | | -#endif |
67 | | - } |
68 | | -} |
69 | | - |
70 | | -file static class ExtensionMethods |
71 | | -{ |
72 | | - public static bool HasError(this Summary[] summaries) |
73 | | - { |
74 | | - if (summaries.Length == 0) |
75 | | - { |
76 | | - var hashSet = new HashSet<string>(["--help", "--list", "--info", "--version"]); |
77 | | - return !Environment.GetCommandLineArgs().Any(hashSet.Contains); |
78 | | - } |
79 | | - |
80 | | - if (summaries.Any(x => x.HasCriticalValidationErrors)) |
81 | | - return true; |
82 | | - |
83 | | - return summaries.Any(x => x.Reports.Any(r => !r.Success)); |
84 | 57 | } |
85 | 58 | } |
0 commit comments