From edb0044e9db84a591e485d9cf2b3334998fd2e9a Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 27 Sep 2022 13:37:46 +0200 Subject: [PATCH 1/2] Add --is-diffs-only and --is-subset-of-diffs It is confusing for jit-analyze to display this summary when invoked through SPMI, since SPMI will only .dasm files for some contexts. Add some options to control the summary written. --- src/jit-analyze/jit-analyze.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/jit-analyze/jit-analyze.cs b/src/jit-analyze/jit-analyze.cs index 572136f0..7c2cf560 100644 --- a/src/jit-analyze/jit-analyze.cs +++ b/src/jit-analyze/jit-analyze.cs @@ -73,6 +73,8 @@ public class Config private bool _retainOnlyTopFiles = false; private double? _overrideTotalBaseMetric; private double? _overrideTotalDiffMetric; + private bool _isDiffsOnly = false; + private bool _isSubsetOfDiffs = false; public Config(string[] args) { @@ -118,6 +120,10 @@ public Config(string[] args) "Override the total base metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known."); syntax.DefineOption("override-total-diff-metric", ref _overrideTotalDiffMetric, ParseDouble, "Override the total diff metric shown in the output with this value. Useful when only changed .dasm files are present and these values are known."); + syntax.DefineOption("is-diffs-only", ref _isDiffsOnly, + "Specify that the disassembly files are only produced for contexts with diffs, so avoid producing output making assumptions about the number of contexts."); + syntax.DefineOption("is-subset-of-diffs", ref _isSubsetOfDiffs, + "Specify that the disassembly files are only a subset of the contexts with diffs, so avoid producing output making assumptions about the remaining diffs."); }); // Run validation code on parsed input to ensure we have a sensible scenario. @@ -172,6 +178,8 @@ private void Validate() public string Note { get { return _note; } } public double? OverrideTotalBaseMetric => _overrideTotalBaseMetric; public double? OverrideTotalDiffMetric => _overrideTotalDiffMetric; + public bool IsDiffsOnly => _isDiffsOnly; + public bool IsSubsetOfDiffs => _isSubsetOfDiffs; public string Filter { get { return _filter; } } @@ -1034,7 +1042,17 @@ void DisplayMethodMetric(string headerText, string subtext, int methodCount, dyn DisplayMethodMetric("Top method regressions", "percentage", methodRegressionCount, sortedMethodRegressionsByPercentage); DisplayMethodMetric("Top method improvements", "percentage", methodImprovementCount, sortedMethodImprovementsByPercentage); - summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed), {unchangedMethodCount} unchanged."); + if (config.IsSubsetOfDiffs) + { + } + else if (config.IsDiffsOnly) + { + summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed)."); + } + else + { + summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed), {unchangedMethodCount} unchanged."); + } if (!config.SkipTextDiff) { From dce4848f2fad29c94e7d3b22766ffc32bdc37265 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 27 Sep 2022 14:01:43 +0200 Subject: [PATCH 2/2] Nit --- src/jit-analyze/jit-analyze.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/jit-analyze/jit-analyze.cs b/src/jit-analyze/jit-analyze.cs index 7c2cf560..c50ed591 100644 --- a/src/jit-analyze/jit-analyze.cs +++ b/src/jit-analyze/jit-analyze.cs @@ -1042,16 +1042,16 @@ void DisplayMethodMetric(string headerText, string subtext, int methodCount, dyn DisplayMethodMetric("Top method regressions", "percentage", methodRegressionCount, sortedMethodRegressionsByPercentage); DisplayMethodMetric("Top method improvements", "percentage", methodImprovementCount, sortedMethodImprovementsByPercentage); - if (config.IsSubsetOfDiffs) + if (!config.IsSubsetOfDiffs) { - } - else if (config.IsDiffsOnly) - { - summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed)."); - } - else - { - summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed), {unchangedMethodCount} unchanged."); + if (config.IsDiffsOnly) + { + summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed)."); + } + else + { + summaryContents.AppendLine($"\n{sortedMethodCount} total methods with {metricDisplayName} differences ({methodImprovementCount} improved, {methodRegressionCount} regressed), {unchangedMethodCount} unchanged."); + } } if (!config.SkipTextDiff)