-
-
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ab86077
Add Event Handler support
caaavik-msft 313ebf1
Merge from master
caaavik-msft aa693f6
Update with latest from main
caaavik-msft 24872ec
Merge branch 'master' into caaavik/EventHandler
caaavik-msft 3f0936d
Add base event handler with virtual methods
caaavik-msft dca4fc7
Add integration tests and fix some bugs
caaavik-msft 9a2c9d4
Remove accidental newline
caaavik-msft c30931f
Address PR comments
caaavik-msft 916d9a5
Address more PR comments
caaavik-msft d78d33d
Make build completion events run sequentially
caaavik-msft e9d3deb
Address further PR comments
caaavik-msft 2c2fc9b
Apply suggestions from code review
adamsitnik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Address PR comments
- Loading branch information
commit c30931f2a340c434c347cf8dc3b47d78cd56e9c0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/BenchmarkDotNet/EventHandlers/BenchmarkEventHandlerBase.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.EventHandlers | ||
| { | ||
| public abstract class BenchmarkEventHandlerBase | ||
| { | ||
| public virtual void OnStartValidationStage() { } | ||
| public virtual void OnValidationError(ValidationError validationError) { } | ||
| public virtual void OnEndValidationStage() { } | ||
| public virtual void OnStartBuildStage() { } | ||
| public virtual void OnBuildFailed(BenchmarkCase benchmarkCase, BuildResult buildResult) { } | ||
| public virtual void OnEndBuildStage() { } | ||
| 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() { } | ||
| } | ||
| } | ||
91 changes: 91 additions & 0 deletions
91
src/BenchmarkDotNet/EventHandlers/CompositeBenchmarkEventHandler.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using BenchmarkDotNet.Reports; | ||
| using BenchmarkDotNet.Running; | ||
| using BenchmarkDotNet.Toolchains.Results; | ||
| using BenchmarkDotNet.Validators; | ||
|
|
||
| namespace BenchmarkDotNet.EventHandlers | ||
| { | ||
| public class CompositeBenchmarkEventHandler : BenchmarkEventHandlerBase | ||
caaavik-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| private readonly IReadOnlyCollection<BenchmarkEventHandlerBase> eventHandlers; | ||
|
|
||
| public CompositeBenchmarkEventHandler(IReadOnlyCollection<BenchmarkEventHandlerBase> eventHandlers) | ||
| { | ||
| this.eventHandlers = eventHandlers; | ||
| } | ||
|
|
||
| public override void OnStartValidationStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnStartValidationStage(); | ||
| } | ||
|
|
||
| public override void OnValidationError(ValidationError validationError) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnValidationError(validationError); | ||
| } | ||
|
|
||
| public override void OnEndValidationStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnEndValidationStage(); | ||
| } | ||
|
|
||
| public override void OnStartBuildStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnStartBuildStage(); | ||
| } | ||
|
|
||
| public override void OnBuildFailed(BenchmarkCase benchmarkCase, BuildResult buildResult) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnBuildFailed(benchmarkCase, buildResult); | ||
| } | ||
|
|
||
| public override void OnEndBuildStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnEndBuildStage(); | ||
| } | ||
|
|
||
| public override void OnStartRunStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnStartRunStage(); | ||
| } | ||
|
|
||
| public override void OnEndRunStage() | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnEndRunStage(); | ||
| } | ||
|
|
||
| public override void OnStartRunBenchmarksInType(Type type, IReadOnlyList<BenchmarkCase> benchmarks) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnStartRunBenchmarksInType(type, benchmarks); | ||
| } | ||
|
|
||
| public override void OnEndRunBenchmarksInType(Type type, Summary summary) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnEndRunBenchmarksInType(type, summary); | ||
| } | ||
|
|
||
| public override void OnEndRunBenchmark(BenchmarkCase benchmarkCase, BenchmarkReport report) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnEndRunBenchmark(benchmarkCase, report); | ||
| } | ||
|
|
||
| public override void OnStartRunBenchmark(BenchmarkCase benchmarkCase) | ||
| { | ||
| foreach (var eventHandler in eventHandlers) | ||
| eventHandler.OnStartRunBenchmark(benchmarkCase); | ||
| } | ||
| } | ||
| } | ||
79 changes: 0 additions & 79 deletions
79
src/BenchmarkDotNet/EventHandlers/CompositeEventHandler.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.