forked from dotnet/performance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend ResultsComparer with what is needed to generate monthly perf r…
…eport (dotnet#2362) * switch to System.CommandLine * remove unused features * extend DTOs with Metrics * move common logic to Helper type * move existing logic to TwoInputsComparer * introduce MultipleInputsComparer that produces the matrix * update docs
- Loading branch information
1 parent
e41db7c
commit c41c582
Showing
11 changed files
with
775 additions
and
298 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 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,55 @@ | ||
using DataTransferContracts; | ||
using Newtonsoft.Json; | ||
using Perfolizer.Mathematics.Multimodality; | ||
using System; | ||
using System.IO; | ||
|
||
namespace ResultsComparer | ||
{ | ||
internal static class Helper | ||
{ | ||
internal const string FullBdnJsonFileExtension = "full.json"; | ||
|
||
internal static string[] GetFilesToParse(string path) | ||
{ | ||
if (Directory.Exists(path)) | ||
return Directory.GetFiles(path, $"*{Helper.FullBdnJsonFileExtension}", SearchOption.AllDirectories); | ||
else if (File.Exists(path) || !path.EndsWith(Helper.FullBdnJsonFileExtension)) | ||
return new[] { path }; | ||
else | ||
throw new FileNotFoundException($"Provided path does NOT exist or is not a {path} file", path); | ||
} | ||
|
||
// code and magic values taken from BenchmarkDotNet.Analysers.MultimodalDistributionAnalyzer | ||
// See http://www.brendangregg.com/FrequencyTrails/modes.html | ||
internal static string GetModalInfo(Benchmark benchmark) | ||
{ | ||
if (benchmark.Statistics.N < 12) // not enough data to tell | ||
return null; | ||
|
||
double mValue = MValueCalculator.Calculate(benchmark.Statistics.OriginalValues); | ||
if (mValue > 4.2) | ||
return "multimodal"; | ||
else if (mValue > 3.2) | ||
return "bimodal"; | ||
else if (mValue > 2.8) | ||
return "several?"; | ||
|
||
return null; | ||
} | ||
|
||
internal static BdnResult ReadFromFile(string resultFilePath) | ||
{ | ||
try | ||
{ | ||
return JsonConvert.DeserializeObject<BdnResult>(File.ReadAllText(resultFilePath)); | ||
} | ||
catch (JsonSerializationException) | ||
{ | ||
Console.WriteLine($"Exception while reading the {resultFilePath} file."); | ||
|
||
throw; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.