-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add event processor functionality #2420
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 10 commits
ab86077
313ebf1
aa693f6
24872ec
3f0936d
dca4fc7
9a2c9d4
c30931f
916d9a5
d78d33d
e9d3deb
2c2fc9b
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 |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using BenchmarkDotNet.Extensions; | ||
| using BenchmarkDotNet.Reports; | ||
| using BenchmarkDotNet.Running; | ||
| using BenchmarkDotNet.Toolchains.Results; | ||
| using BenchmarkDotNet.Validators; | ||
|
|
||
| namespace BenchmarkDotNet.EventProcessors | ||
| { | ||
| internal sealed class CompositeEventProcessor : EventProcessorBase | ||
| { | ||
| private readonly IReadOnlyCollection<EventProcessorBase> eventProcessors; | ||
|
|
||
| public CompositeEventProcessor(BenchmarkRunInfo[] benchmarkRunInfos) | ||
| { | ||
| var eventProcessors = new HashSet<EventProcessorBase>(); | ||
|
|
||
| foreach (var info in benchmarkRunInfos) | ||
| eventProcessors.AddRange(info.Config.GetEventProcessors()); | ||
|
|
||
| this.eventProcessors = eventProcessors; | ||
| } | ||
|
|
||
| public CompositeEventProcessor(IReadOnlyCollection<EventProcessorBase> eventProcessors) | ||
| { | ||
| this.eventProcessors = eventProcessors; | ||
| } | ||
caaavik-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public override void OnStartValidationStage() | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnStartValidationStage(); | ||
| } | ||
|
|
||
| public override void OnValidationError(ValidationError validationError) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnValidationError(validationError); | ||
| } | ||
|
|
||
| public override void OnEndValidationStage() | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnEndValidationStage(); | ||
| } | ||
|
|
||
| public override void OnStartBuildStage(IReadOnlyList<BuildPartition> partitions) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnStartBuildStage(partitions); | ||
| } | ||
|
|
||
| public override void OnBuildComplete(BuildPartition buildPartition, BuildResult buildResult) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnBuildComplete(buildPartition, buildResult); | ||
| } | ||
|
|
||
| public override void OnEndBuildStage() | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnEndBuildStage(); | ||
| } | ||
|
|
||
| public override void OnStartRunStage() | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnStartRunStage(); | ||
| } | ||
|
|
||
| public override void OnEndRunStage() | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnEndRunStage(); | ||
| } | ||
|
|
||
| public override void OnStartRunBenchmarksInType(Type type, IReadOnlyList<BenchmarkCase> benchmarks) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnStartRunBenchmarksInType(type, benchmarks); | ||
| } | ||
|
|
||
| public override void OnEndRunBenchmarksInType(Type type, Summary summary) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnEndRunBenchmarksInType(type, summary); | ||
| } | ||
|
|
||
| public override void OnEndRunBenchmark(BenchmarkCase benchmarkCase, BenchmarkReport report) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnEndRunBenchmark(benchmarkCase, report); | ||
| } | ||
|
|
||
| public override void OnStartRunBenchmark(BenchmarkCase benchmarkCase) | ||
| { | ||
| foreach (var eventProcessor in eventProcessors) | ||
| eventProcessor.OnStartRunBenchmark(benchmarkCase); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using BenchmarkDotNet.Reports; | ||
| using BenchmarkDotNet.Running; | ||
| using BenchmarkDotNet.Toolchains.Results; | ||
| using BenchmarkDotNet.Validators; | ||
|
|
||
| namespace BenchmarkDotNet.EventProcessors | ||
| { | ||
| public abstract class EventProcessorBase | ||
caaavik-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| public virtual void OnStartValidationStage() { } | ||
| public virtual void OnValidationError(ValidationError validationError) { } | ||
| public virtual void OnEndValidationStage() { } | ||
| public virtual void OnStartBuildStage(IReadOnlyList<BuildPartition> partitions) { } | ||
| public virtual void OnBuildComplete(BuildPartition benchmarkCase, BuildResult buildResult) { } | ||
| public virtual void OnEndBuildStage() { } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the difference between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is the difference between them. |
||
| public virtual void OnStartRunStage() { } | ||
| public virtual void OnStartRunBenchmarksInType(Type type, IReadOnlyList<BenchmarkCase> benchmarks) { } | ||
| public virtual void OnEndRunBenchmarksInType(Type type, Summary summary) { } | ||
| public virtual void OnStartRunBenchmark(BenchmarkCase benchmarkCase) { } | ||
| public virtual void OnEndRunBenchmark(BenchmarkCase benchmarkCase, BenchmarkReport report) { } | ||
| public virtual void OnEndRunStage() { } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.