RunAsync Method
Definition
- Namespace
- Codebelt.Extensions.BenchmarkDotNet.Console
- Assemblies
- Codebelt.Extensions.BenchmarkDotNet.Console.dll
RunAsync(string[], Action<BenchmarkWorkspaceOptions>)
Runs benchmarks asynchronously using the default BenchmarkWorkspace implementation.
public static Task RunAsync(string[] args, Action<BenchmarkWorkspaceOptions> setup = null)
Parameters
argsstring[]The command-line arguments passed to the application.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- Task
A task that represents the asynchronous benchmark host operation.
Remarks
This method configures the host builder with the necessary services, builds the host, and runs it asynchronously to execute benchmarks.
RunAsync(string[], Action<IServiceCollection>, Action<BenchmarkWorkspaceOptions>)
Runs benchmarks asynchronously using the default BenchmarkWorkspace implementation.
public static Task RunAsync(string[] args, Action<IServiceCollection> serviceConfigurator = null, Action<BenchmarkWorkspaceOptions> setup = null)
Parameters
argsstring[]The command-line arguments passed to the application.
serviceConfiguratorAction<IServiceCollection>The delegate that will be invoked to configure additional services in the IServiceCollection.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- Task
A task that represents the asynchronous benchmark host operation.
Remarks
This method configures the host builder with the necessary services, builds the host, and runs it asynchronously to execute benchmarks.
RunAsync<TWorkspace>(string[], Action<BenchmarkWorkspaceOptions>)
Runs benchmarks asynchronously using a custom implementation of IBenchmarkWorkspace.
public static Task RunAsync<TWorkspace>(string[] args, Action<BenchmarkWorkspaceOptions> setup = null) where TWorkspace : class, IBenchmarkWorkspace
Parameters
argsstring[]The command-line arguments passed to the application.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- Task
A task that represents the asynchronous benchmark host operation.
Type Parameters
TWorkspaceThe type of the workspace that implements IBenchmarkWorkspace.
Remarks
This method configures the host builder with the necessary services, builds the host, and runs it asynchronously to execute benchmarks.
RunAsync<TWorkspace>(string[], Action<IServiceCollection>, Action<BenchmarkWorkspaceOptions>)
Runs benchmarks asynchronously using a custom implementation of IBenchmarkWorkspace.
public static Task RunAsync<TWorkspace>(string[] args, Action<IServiceCollection> serviceConfigurator = null, Action<BenchmarkWorkspaceOptions> setup = null) where TWorkspace : class, IBenchmarkWorkspace
Parameters
argsstring[]The command-line arguments passed to the application.
serviceConfiguratorAction<IServiceCollection>The delegate that will be invoked to configure additional services in the IServiceCollection.
setupAction<BenchmarkWorkspaceOptions>The BenchmarkWorkspaceOptions which may be configured.
Returns
- Task
A task that represents the asynchronous benchmark host operation.
Type Parameters
TWorkspaceThe type of the workspace that implements IBenchmarkWorkspace.
Remarks
This method configures the host builder with the necessary services, builds the host, and runs it asynchronously to execute benchmarks.
RunAsync(IServiceProvider, CancellationToken)
Runs the actual benchmarks as envisioned by BenchmarkDotNet.
public override Task RunAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken)
Parameters
serviceProviderIServiceProviderThe service provider.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A completed task when benchmark execution has finished.
Remarks
When arguments are provided, they are forwarded to BenchmarkDotNet.Running.BenchmarkSwitcher for selective execution. After execution completes, artifact post-processing is performed.