-
Notifications
You must be signed in to change notification settings - Fork 4
fix: migrate PerfDiff to System.CommandLine 2.0.3 #1043
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 all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
cedc672
fix: migrate PerfDiff to System.CommandLine 2.0.3
rjmurillo bbb8e62
fix(PerfDiff): restore console color on exception and avoid repeated …
rjmurillo eaac9bc
fix(PerfDiff): dispose ServiceProvider after use
rjmurillo ebed699
refactor(PerfDiff): simplify ServiceProvider disposal and remove dead…
rjmurillo 4ab30c3
fix(deps): update Perfolizer version to 0.6.7
rjmurillo 1d5a79b
fix(perfdiff): make --baseline and --results options required
rjmurillo 26c2062
fix(perfdiff): wire failOnRegression flag through CompareAsync properly
rjmurillo 4893082
fix(PerfDiff): return exit code from SetAction lambda
rjmurillo 1434e6b
refactor: simplify code in PR #1043
rjmurillo 53ead04
refactor(PerfDiff): fix System.CommandLine 2.0.3 API and reduce noise
rjmurillo 1dee067
fix: register LoggerFactory via factory delegate for proper disposal
rjmurillo 6328dfb
Merge remote-tracking branch 'origin/main' into fix/914-perfdiff-syst…
rjmurillo b31b679
fix: resolve LoggerFactory double registration and narrow accessibility
rjmurillo 7b8216b
fix: narrow Program.RunAsync accessibility to internal
rjmurillo 5a78546
Merge remote-tracking branch 'origin/main' into fix/914-perfdiff-syst…
rjmurillo 29ec00d
fix: update package snapshot files to include THIRD-PARTY-NOTICES.TXT
rjmurillo 9cd3587
refactor: eliminate DRY violation and use FrozenDictionary in PerfDiff
rjmurillo a4c4dd1
Merge remote-tracking branch 'origin/main' into fix/914-perfdiff-syst…
rjmurillo bec8f65
refactor: consolidate verbosity mapping into single source of truth
rjmurillo e63d03c
Merge branch 'main' into fix/914-perfdiff-system-commandline
rjmurillo 3c27914
fix: make logger gate lock static to prevent concurrent color interle…
rjmurillo 8fbd3e3
Merge branch 'main' into fix/914-perfdiff-system-commandline
rjmurillo c1d3c60
fix(deps): pin Perfolizer to 0.6.1 to match BenchmarkDotNet 0.15.8
rjmurillo 85c6680
test: update generic callback test to expect diagnostic
rjmurillo 4a550bb
fix: replace const with static readonly to satisfy ECS0200
rjmurillo 59d887a
style: mark SetAction lambda as static to prevent accidental closures
rjmurillo 59f3af8
refactor: remove redundant StringComparer from Dictionary constructor
rjmurillo 9027ccd
refactor: set explicit Dictionary capacity and cache logger instance
rjmurillo 10c6afb
fix: promote regression log messages to Warning and set factory minim…
rjmurillo c4a2bfb
Merge branch 'main' into fix/914-perfdiff-system-commandline
rjmurillo 357a530
Merge branch 'fix/914-perfdiff-system-commandline' of https://github.…
rjmurillo 4e1b985
merge: update with latest main (meziantou.analyzer 3.0.21)
rjmurillo 9fedf86
revert: restore const for PerfDiff fields (ECS0200 is disabled)
rjmurillo f5efa1f
fix: log full exception for FileNotFoundException in PerfDiff
rjmurillo d5adf9d
chore(deps): update dependency meziantou.analyzer to 3.0.22 (#1059)
renovate[bot] de0e280
Merge remote-tracking branch 'origin/main' into fix/914-perfdiff-syst…
rjmurillo 53bc572
fix(PerfDiff): thread CancellationToken through async call chain
rjmurillo 69978a3
fix(PerfDiff): replace SingleOrDefault with FirstOrDefault for ETL files
rjmurillo 374d9cf
docs(PerfDiff): add XML param tags for CancellationToken parameters
rjmurillo 74429a3
refactor(PerfDiff): simplify LINQ patterns and fix structured logging
rjmurillo 2daa71d
test(PerfDiff): add tests for CancellationToken, ETL paths, and CLI c…
rjmurillo f1765f5
fix(PerfDiff): resolve unused variable warning in RunAsync
rjmurillo 44efced
merge: update with latest main
rjmurillo 4cfa058
Merge branch 'main' into fix/914-perfdiff-system-commandline
rjmurillo 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,11 +24,12 @@ | |
| /// <param name="baselineFolder">The folder containing baseline results.</param> | ||
| /// <param name="resultsFolder">The folder containing new results.</param> | ||
| /// <param name="logger">Logger for reporting errors.</param> | ||
| /// <param name="cancellationToken">Token to observe for cancellation requests.</param> | ||
| /// <returns>A <see cref="BenchmarkComparisonResult"/> indicating comparison success and regression detection.</returns> | ||
| public static async Task<BenchmarkComparisonResult> TryCompareBenchmarkDotNetResultsAsync(string baselineFolder, string resultsFolder, ILogger logger) | ||
| public static async Task<BenchmarkComparisonResult> TryCompareBenchmarkDotNetResultsAsync(string baselineFolder, string resultsFolder, ILogger logger, CancellationToken cancellationToken) | ||
| { | ||
| BenchmarkComparisonService service = new(logger); | ||
| return await service.CompareAsync(baselineFolder, resultsFolder).ConfigureAwait(false); | ||
| return await service.CompareAsync(baselineFolder, resultsFolder, cancellationToken).ConfigureAwait(false); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -37,8 +38,9 @@ | |
| /// <param name="baselineFolder">The folder containing baseline results.</param> | ||
| /// <param name="resultsFolder">The folder containing new results.</param> | ||
| /// <param name="logger">Logger for reporting errors.</param> | ||
| /// <param name="cancellationToken">Token to observe for cancellation requests.</param> | ||
| /// <returns>An array of <see cref="BdnComparisonResult"/> if successful; otherwise, <see langword="null"/>.</returns> | ||
| internal static async Task<BdnComparisonResult[]?> TryGetBdnResultsAsync(string baselineFolder, string resultsFolder, ILogger logger) | ||
| internal static async Task<BdnComparisonResult[]?> TryGetBdnResultsAsync(string baselineFolder, string resultsFolder, ILogger logger, CancellationToken cancellationToken) | ||
|
Check warning on line 43 in src/tools/PerfDiff/BDN/BenchmarkDotNetDiffer.cs
|
||
| { | ||
| if (!TryGetFilesToParse(baselineFolder, out string[]? baseFiles)) | ||
| { | ||
|
|
@@ -52,19 +54,19 @@ | |
| return null; | ||
| } | ||
|
|
||
| if (!baseFiles.Any() || !resultsFiles.Any()) | ||
| if (baseFiles.Length == 0 || resultsFiles.Length == 0) | ||
| { | ||
| logger.LogError($"Provided paths contained no '{FullBdnJsonFileExtension}' files."); | ||
| logger.LogError("Provided paths contained no '{FileExtension}' files.", FullBdnJsonFileExtension); | ||
| return null; | ||
| } | ||
|
|
||
| (bool baseResultsSuccess, BdnResult?[] baseResults) = await BenchmarkFileReader.TryGetBdnResultAsync(baseFiles, logger).ConfigureAwait(false); | ||
| (bool baseResultsSuccess, BdnResult?[] baseResults) = await BenchmarkFileReader.TryGetBdnResultAsync(baseFiles, logger, cancellationToken).ConfigureAwait(false); | ||
| if (!baseResultsSuccess) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| (bool resultsSuccess, BdnResult?[] diffResults) = await BenchmarkFileReader.TryGetBdnResultAsync(resultsFiles, logger).ConfigureAwait(false); | ||
| (bool resultsSuccess, BdnResult?[] diffResults) = await BenchmarkFileReader.TryGetBdnResultAsync(resultsFiles, logger, cancellationToken).ConfigureAwait(false); | ||
| if (!resultsSuccess) | ||
| { | ||
| return null; | ||
|
|
@@ -78,10 +80,16 @@ | |
| .SelectMany(result => result?.Benchmarks ?? Enumerable.Empty<Benchmark>()) | ||
| .ToDictionary(benchmarkResult => benchmarkResult.FullName ?? $"Unknown-{Guid.NewGuid():N}", benchmarkResult => benchmarkResult); | ||
|
|
||
| return benchmarkIdToBaseResults | ||
| .Where(baseResult => benchmarkIdToDiffResults.ContainsKey(baseResult.Key)) | ||
| .Select(baseResult => new BdnComparisonResult(baseResult.Key, baseResult.Value, benchmarkIdToDiffResults[baseResult.Key])) | ||
| .ToArray(); | ||
| List<BdnComparisonResult> matched = []; | ||
| foreach (KeyValuePair<string, Benchmark> baseResult in benchmarkIdToBaseResults) | ||
| { | ||
| if (benchmarkIdToDiffResults.TryGetValue(baseResult.Key, out Benchmark? diffBenchmark)) | ||
| { | ||
| matched.Add(new BdnComparisonResult(baseResult.Key, baseResult.Value, diffBenchmark)); | ||
| } | ||
| } | ||
|
|
||
| return matched.ToArray(); | ||
|
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. |
||
| } | ||
|
|
||
| private static bool TryGetFilesToParse(string path, [NotNullWhen(true)] out string[]? files) | ||
|
|
||
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
16 changes: 0 additions & 16 deletions
16
src/tools/PerfDiff/Logging/SimpleConsoleLoggerFactoryExtensions.cs
This file was deleted.
Oops, something went wrong.
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
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.