-
Notifications
You must be signed in to change notification settings - Fork 297
Average multi microbenchmarks results #5215
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
Draft
VincentBu
wants to merge
42
commits into
dotnet:main
Choose a base branch
from
VincentBu:average-microbenchmarks-iterations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 16 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
9db4f30
add iterations section for end-2-end config and set for microbenchmar…
VincentBu a730074
Merge branch 'dotnet:main' into average-microbenchmarks-iterations
VincentBu 9802484
add json-trace map and implement AnalyzeForBenchmark
VincentBu f2318ac
Calculate comparison result by benchmark name, rename classes and adj…
VincentBu e34745b
present list of microbenchmarkresults
VincentBu e9594b3
rename iteration section to iterations for Run.yaml
VincentBu c3f4b45
Potential fix for pull request finding
VincentBu 240ceb8
fix for microbencharmks comparison
VincentBu 1b08bd0
fix bugs intrduced in previous commit
VincentBu 434a17c
Add json-only comparison
VincentBu faca628
extract a shared helper for analyze command
VincentBu ab17bf3
take trace type into consideration
VincentBu 70c7f16
move MicrobenchmarkResult to GC.Infrastructure.Core.Analysis.Microben…
VincentBu d9b160d
validate if run is null
VincentBu 2ba9f6b
rename PauseDurationSeconds_SumWhereIsGen1 to PauseDurationMSec_SumWh…
VincentBu 1dc65f5
assign value for PromotedMB_MeanWhereIsGen1
VincentBu 6915009
add properties for microbenchmarks comparison
VincentBu 2b51863
get value from StatsData if property is not found in GCTraceMetrics
VincentBu 69ea04d
filtering to finite values
VincentBu 30c9c91
check possible null references
VincentBu 3b38059
add console output when analyzing results
VincentBu 866e09d
Merge branch 'average-microbenchmarks-iterations' of https://github.c…
VincentBu f9c6d08
redesign microbenchmarks result
VincentBu 3b78ca3
redesign microbenchmarkresult
VincentBu b7cb942
Merge pull request #1 from VincentBu/redesign-microbenchmark-result
VincentBu 8096656
move presentation to analyze-command
VincentBu ec7b882
improve performance of analyzing stage
VincentBu 6ba2219
includes int type properties
VincentBu cc59167
check key existence and set parallelism degree to 2 * cpu_count
VincentBu a7c1b2c
check if metricName is a key of StatsData
VincentBu 357ce0a
Filter out null GCTraceMetrics instances before calling CompareGCTrac…
VincentBu 3d1c330
update initialization of OtherMetrics for MicrobenchmarkComparisonResult
VincentBu eb9f7e3
comment out cpu_columns related code
VincentBu 7d5709a
remove unused imports
VincentBu 994ea7a
"Microbechmark" (missing 'n')
VincentBu ac9ec48
avoid breaking formatting
VincentBu b7bfe3d
sort improvements in ascending order
VincentBu 08ec2a5
Convert to ToDictionary(x => x.Item1, x => x.Item2) (or tuple names) …
VincentBu 722ace7
provide key value pair projection
VincentBu cf32db5
sort in order by index
VincentBu 766fc82
remove Spectre markup tokens from output path
VincentBu 2ba985f
Check if first baseline/comparand is null
VincentBu 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
8 changes: 8 additions & 0 deletions
8
...enchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/GCTraceMetricComparison.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,8 @@ | ||
| namespace GC.Infrastructure.Core.Analysis | ||
| { | ||
| public static class GCTraceMetricComparison | ||
| { | ||
| public static GCTraceMetricComparisonResult CompareGCTraceMetric(IEnumerable<GCTraceMetrics> baselines, IEnumerable<GCTraceMetrics> comparands,string nameOfMetric) | ||
| => new GCTraceMetricComparisonResult(baselines, comparands, nameOfMetric); | ||
| } | ||
| } |
100 changes: 100 additions & 0 deletions
100
...rks/gc/GC.Infrastructure/GC.Infrastructure.Core/Analysis/GCTraceMetricComparisonResult.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,100 @@ | ||
| using GC.Analysis.API; | ||
| using Microsoft.Diagnostics.Tracing.Analysis.GC; | ||
| using System.Reflection; | ||
|
|
||
| namespace GC.Infrastructure.Core.Analysis | ||
| { | ||
| public sealed class GCTraceMetricComparisonResult | ||
|
VincentBu marked this conversation as resolved.
|
||
| { | ||
| public GCTraceMetricComparisonResult(IEnumerable<GCTraceMetrics> baselines, IEnumerable<GCTraceMetrics> comparands, string metricName) | ||
| { | ||
| RunName = baselines.FirstOrDefault()?.RunName; | ||
| Key = $"{baselines.FirstOrDefault()?.ConfigurationName}_{RunName}"; | ||
|
|
||
| MetricName = metricName; | ||
| PropertyInfo pInfo = typeof(GCTraceMetrics).GetProperty(metricName, BindingFlags.Instance | BindingFlags.Public); | ||
|
|
||
| // Property found on the GCTraceMetrics. | ||
| if (pInfo != null) | ||
| { | ||
| OriginalBaselineMetricCollection = GoodLinq.Select(baselines, baseline => (double)pInfo.GetValue(baseline)); | ||
| OriginalComparandMetricCollection = GoodLinq.Select(comparands, comparand => (double)pInfo.GetValue(comparand)); | ||
| } | ||
|
|
||
| // If property isn't found on the GCTraceMetrics, look in GCStats. | ||
| // TODO: Add the case where we look into the map. | ||
| else | ||
| { | ||
| pInfo = typeof(GCStats).GetProperty(metricName, BindingFlags.Instance | BindingFlags.Public); | ||
| if (pInfo == null) | ||
| { | ||
| FieldInfo fieldInfo = typeof(GCStats).GetField(metricName, BindingFlags.Instance | BindingFlags.Public); | ||
| if (fieldInfo == null) | ||
| { | ||
| // Out of luck! | ||
| OriginalBaselineMetricCollection = Array.Empty<double>(); | ||
| OriginalComparandMetricCollection = Array.Empty<double>(); | ||
| OutliersFreeBaselineMetricCollection = Array.Empty<double>(); | ||
| OutliersFreeComparandMetricCollection = Array.Empty<double>(); | ||
| AveragedBaselineMetric = double.NaN; | ||
| AveragedComparandMetric = double.NaN; | ||
| return; | ||
| } | ||
|
|
||
| else | ||
| { | ||
| OriginalBaselineMetricCollection = GoodLinq.Select(baselines, baseline => (double)fieldInfo.GetValue(baseline)); | ||
| OriginalComparandMetricCollection = GoodLinq.Select(comparands, comparand => (double)fieldInfo.GetValue(comparand)); | ||
| } | ||
| } | ||
|
|
||
| else | ||
| { | ||
| OriginalBaselineMetricCollection = GoodLinq.Select(baselines, baseline => (double)pInfo.GetValue(baseline)); | ||
| OriginalComparandMetricCollection = GoodLinq.Select(comparands, comparand => (double)pInfo.GetValue(comparand)); | ||
| } | ||
|
VincentBu marked this conversation as resolved.
VincentBu marked this conversation as resolved.
VincentBu marked this conversation as resolved.
VincentBu marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // Filter out outliers using IQR method | ||
| OutliersFreeBaselineMetricCollection = GC.Analysis.API.Statistics.RemoveOutliers(OriginalBaselineMetricCollection); | ||
| OutliersFreeComparandMetricCollection = GC.Analysis.API.Statistics.RemoveOutliers(OriginalComparandMetricCollection); | ||
|
|
||
| // Calculate averaged metrics | ||
| AveragedBaselineMetric = GoodLinq.Average(OutliersFreeBaselineMetricCollection, r => r); | ||
| AveragedComparandMetric = GoodLinq.Average(OutliersFreeComparandMetricCollection, r => r); | ||
| } | ||
|
|
||
| public string RunName { get; } | ||
| public string Key { get; } | ||
| public string MetricName { get; } | ||
| public IEnumerable<double> OriginalBaselineMetricCollection { get; } | ||
| public IEnumerable<double> OriginalComparandMetricCollection { get; } | ||
| public IEnumerable<double> OutliersFreeBaselineMetricCollection { get; } | ||
| public IEnumerable<double> OutliersFreeComparandMetricCollection { get; } | ||
|
|
||
| public double AveragedBaselineMetric { get; } | ||
| public double AveragedComparandMetric { get; } | ||
| public double Delta => AveragedComparandMetric - AveragedBaselineMetric; | ||
| public double PercentageDelta | ||
| { | ||
| get | ||
| { | ||
| if (AveragedBaselineMetric == 0) | ||
| { | ||
| if (AveragedComparandMetric == 0) | ||
| { | ||
| return 0; | ||
| } | ||
| else | ||
| { | ||
| return double.NaN; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| return Delta / AveragedBaselineMetric * 100.0; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
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.