-
Notifications
You must be signed in to change notification settings - Fork 0
V1.1.0/worker flexibility #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
9f1f8be
b0f881d
d5809b9
9168aea
84a2fcb
1e0ff38
6fea611
7a9dfe6
408f808
0e0d6be
d5a7839
d846b10
47dd6f7
c4d8af5
e4dd07c
e106a28
1f97e1a
45ea81d
f54af1e
e7975bc
852937f
5f3e63e
d7f1dd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,12 @@ | |
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Hosting; | ||
| using System; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using BenchmarkDotNet.Configs; | ||
| using BenchmarkDotNet.Filters; | ||
|
|
||
| namespace Codebelt.Extensions.BenchmarkDotNet.Console | ||
| { | ||
|
|
@@ -33,7 +37,7 @@ | |
| /// </remarks> | ||
| public override void ConfigureServices(IServiceCollection services) | ||
| { | ||
| services.Configure<ConsoleLifetimeOptions>(o => o.SuppressStatusMessages = true); | ||
| services.Configure<ConsoleLifetimeOptions>(o => o.SuppressStatusMessages = !BenchmarkProgram.IsDebugBuild); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -46,13 +50,39 @@ | |
| /// When arguments are provided, they are forwarded to <see cref="BenchmarkSwitcher"/> for selective execution. | ||
| /// After execution completes, the worker performs artifact post-processing. | ||
| /// </remarks> | ||
| public override Task RunAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken) | ||
|
Check warning on line 53 in src/Codebelt.Extensions.BenchmarkDotNet.Console/BenchmarkWorker.cs
|
||
| { | ||
| var options = serviceProvider.GetRequiredService<BenchmarkWorkspaceOptions>(); | ||
| var workspace = serviceProvider.GetRequiredService<IBenchmarkWorkspace>(); | ||
| var assemblies = workspace.LoadBenchmarkAssemblies(); | ||
| var context = serviceProvider.GetRequiredService<BenchmarkContext>(); | ||
|
|
||
| if (options.SkipBenchmarksWithReports) | ||
| { | ||
| var benchmarkTypes = assemblies.SelectMany(a => a.GetTypes().Where(t => t.Name.EndsWith("Benchmark"))).ToList(); | ||
|
Check warning on line 62 in src/Codebelt.Extensions.BenchmarkDotNet.Console/BenchmarkWorker.cs
|
||
gimlichael marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| options.ConfigureBenchmarkDotNet(c => | ||
| { | ||
| var reports = Directory.EnumerateFiles(BenchmarkWorkspace.GetReportsTuningPath(options)); | ||
gimlichael marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
gimlichael marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| foreach (var report in reports) | ||
| { | ||
| var filename = Path.GetFileNameWithoutExtension(report); | ||
| var potentialTypeFullName = filename.Split('-').FirstOrDefault(); | ||
| if (string.IsNullOrWhiteSpace(potentialTypeFullName)) { continue; } | ||
|
|
||
| var potentialTypeName = potentialTypeFullName.Split('.').LastOrDefault(); | ||
| if (string.IsNullOrWhiteSpace(potentialTypeName)) { continue; } | ||
|
|
||
| var matchingType = benchmarkTypes.SingleOrDefault(t => t.Name.Equals(potentialTypeName, StringComparison.OrdinalIgnoreCase)); | ||
gimlichael marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
gimlichael marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (matchingType != null) | ||
| { | ||
| c = c.AddFilter(new SimpleFilter(bc => bc.Descriptor.Type != matchingType)); | ||
| } | ||
| } | ||
gimlichael marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return c; | ||
| }); | ||
| } | ||
|
|
||
| try | ||
| { | ||
| if (context.Args.Length == 0) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.