diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.dib index 4ef5e9f6026..731846083e5 100644 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.dib +++ b/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.dib @@ -8,8 +8,5 @@ dotnet build -c Release "..\GC.Analysis.API" #!csharp -#!import Utils.dib #!import DataManager.dib -#!import Reports-Imports.dib -#!import Reports-Impl.dib -#!import Reports-Data.dib +#!import Reports.dib diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md b/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md index e8e886fd354..332f52d96f3 100644 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md +++ b/src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md @@ -1,3 +1,4 @@ +# Workflow HERE!!! # Benchmark Analysis diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/DataManager.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/DataManager.dib index 6b3eaca5bac..3c20162e09c 100644 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/DataManager.dib +++ b/src/benchmarks/gc/GC.Infrastructure/Notebooks/DataManager.dib @@ -7,15 +7,53 @@ #i "nuget: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" #r "nuget: Microsoft.Diagnostics.Tracing.TraceEvent" +#r "nuget: Microsoft.Data.Analysis, 0.19.1" +//#r "nuget: Newtonsoft.Json" +#r "nuget: XPlot.Plotly" +#r "nuget: XPlot.Plotly.Interactive" +//#r "nuget: YamlDotnet" // TODO: Ensure you are pointing to the right artifacts folder. #r "..\..\..\..\..\artifacts\bin\GC.Analysis.API\Release\net7.0\GC.Analysis.API.dll" -using GC.Analysis.API; - using System.IO; using System.Text.RegularExpressions; +using GC.Analysis.API; + +//using Etlx = Microsoft.Diagnostics.Tracing.Etlx; +//using Microsoft.Data.Analysis; +using Microsoft.Diagnostics.Tracing.Analysis.GC; +//using Microsoft.Diagnostics.Tracing.Analysis; +using Microsoft.Diagnostics.Tracing.Parsers.Clr; +//using Microsoft.Diagnostics.Tracing; +//using Newtonsoft.Json; +//using System.Diagnostics; +using XPlot.Plotly; + +#!csharp + +// ML and MA are convenience syntax for making lists and arrays. +public static List ML(params T[] elems) => new List(elems); +public static T[] MA(params T[] elems) => elems; + +public static V GetOrAdd(this Dictionary dict, K key, V value) + => dict.TryAdd(key, value) ? value : dict[key]; + +public static void SetWithExtend(this List list, int index, T value) +{ + int count = list.Count; + int needed = index + 1; + for (int i = 0; i < (needed - count); ++i) + { + list.Add(default(T)); + } + list[index] = value; +} + +public static IEnumerable<(T, int)> WithIndex(this IEnumerable list) => list.Select((value, index) => (value, index)); +public static bool NotNull(T x) => x != null; + #!csharp // Data Acquisition diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Data.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Data.dib deleted file mode 100644 index 9d05c5b2f31..00000000000 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Data.dib +++ /dev/null @@ -1,46 +0,0 @@ -#!meta - -{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"languageName":"csharp","name":"csharp"}]}} - -#!csharp - -// Benchmark lists - -// scoutList is a list of ASP.NET benchmarks identified by looking at allocation rates. -// scoutList2 adds some tests that Maoni identified. -// smallList is for very quick looks. - -// Often a test infra run will have been limited to a smaller set of tests when desired, -// in which case these aren't necessary. However, these predefined lists can be used to -// help load (or chart after loading) a subset of a run when desired. - -List scoutList = ML( - "ConnectionClose", - "ConnectionCloseHttps", - "ConnectionCloseHttpsHttpSys", - "ConnectionCloseHttpSys", - "Fortunes", - "FortunesDapper", - "FortunesEf", - "FortunesPlatform", - "FortunesPlatformDapper", - "FortunesPlatformEF", - "Json", - "JsonHttps", - "JsonHttpsHttpSys", - "JsonMin", - "JsonMvc", - "MultipleQueriesPlatform", - "PlaintextMvc", - "PlaintextQueryString", - "PlaintextWithParametersEmptyFilter", - "PlaintextWithParametersNoFilter", - "SingleQueryPlatform", - "Stage1", - "Stage1Grpc", - "Stage2", - "UpdatesPlatform" -); - -List scoutList2 = scoutList.Concat(ML("CachingPlatform", "JsonMapAction", "Stage1TrimR2RSingleFile")).ToList(); -List smallList = ML("Fortunes", "JsonHttpsHttpSys", "PlaintextQueryString", "Stage2", "PlaintextMvc"); diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Examples.ipynb b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Examples.ipynb index deba7168c13..49fbb492fb8 100644 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Examples.ipynb +++ b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Examples.ipynb @@ -35,16 +35,9 @@ }, "outputs": [], "source": [ - "// This only needs to be evaluated when iterating on the Reports-Impl code.\n", + "// This only needs to be evaluated when iterating on the Reports code itself.\n", "\n", - "#!import Reports-Impl.dib" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Examples" + "#!import Reports.dib" ] }, { diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Imports.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Imports.dib deleted file mode 100644 index 9979433bbb5..00000000000 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Imports.dib +++ /dev/null @@ -1,23 +0,0 @@ -#!meta - -{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"languageName":"csharp","name":"csharp"}]}} - -#!csharp - -#i "nuget: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" - -//#r "nuget: YamlDotnet" -#r "nuget: XPlot.Plotly" -#r "nuget: XPlot.Plotly.Interactive" -#r "nuget: Microsoft.Data.Analysis, 0.19.1" -//#r "nuget: Newtonsoft.Json" - -//using Etlx = Microsoft.Diagnostics.Tracing.Etlx; -//using Microsoft.Data.Analysis; -using Microsoft.Diagnostics.Tracing.Analysis.GC; -//using Microsoft.Diagnostics.Tracing.Analysis; -using Microsoft.Diagnostics.Tracing.Parsers.Clr; -//using Microsoft.Diagnostics.Tracing; -//using Newtonsoft.Json; -//using System.Diagnostics; -using XPlot.Plotly; diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Impl.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports.dib similarity index 97% rename from src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Impl.dib rename to src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports.dib index 657e9771c89..e2b952d9fb1 100644 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Impl.dib +++ b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports.dib @@ -4,6 +4,17 @@ #!csharp +// Instructions to get Intellisense, etc., in this file: +// +// Normally this file is #!import-ed into an environment (BenchmarkAnalysis.dib) that already has types such as DataManager defined. +// However, to work on this file, we need that context available here. To get that, uncomment the following #!import, execute this +// cell, and then comment the line again. This will provide an editing environment. Keeping it commented it necessary because +// splitting the imports/usings in the BenchmarkAnalysis case can cause strange name resolution and type conversion errors. + +//#!import DataManager.dib + +#!csharp + // Huge block of code that operates on DataManager // ----------------------------------------------- @@ -479,7 +490,7 @@ public class Metric : BaseMetric public static class Metrics { public static Metric Promote(Metric metric, Aggregation aggregation) - => Metric.Promote(metric, iterationData => (IEnumerable)iterationData.GCProcessData.GCs, aggregation); + => Metric.Promote(metric, iterationData => iterationData.GCProcessData.GCs, aggregation); public static Metric Promote(Metric metric, Aggregation aggregation) => Metric.Promote(metric, benchmarkData => benchmarkData.Iterations, aggregation); public static Metric Promote(Metric metric, Aggregation aggregation) @@ -885,7 +896,7 @@ class TraceGCChartType : ChartType public override List> GetDataSource(SeriesInfo info, Filter benchmarkFilter, IntFilter iterationFilter, ConfigIterationFilter configIterationFilter, Func dataFilter) - => ((IEnumerable)info.IterationData.GCProcessData?.GCs).Where(gc => gc.GlobalHeapHistory != null).Where(dataFilter).Select(gc => KeyValuePair.Create("", gc)); + => info.IterationData.GCProcessData?.GCs.Where(gc => gc.GlobalHeapHistory != null).Where(dataFilter).Select(gc => KeyValuePair.Create("", gc)); } public struct XValue : IComparable, IEquatable @@ -1754,3 +1765,46 @@ List ChartGCData(DataManager dataManager, Metric metric, benchmarkMap: benchmarkMap, xMetric: xMetric, xArrangement: xArrangement, configNameSimplifier: configNameSimplifier, includeRunName: includeRunName, display: display, debug: debug); + +#!csharp + +// Benchmark lists + +// scoutList is a list of ASP.NET benchmarks identified by looking at allocation rates. +// scoutList2 adds some tests that Maoni identified. +// smallList is for very quick looks. + +// Often a test infra run will have been limited to a smaller set of tests when desired, +// in which case these aren't necessary. However, these predefined lists can be used to +// help load (or chart after loading) a subset of a run when desired. + +List scoutList = ML( + "ConnectionClose", + "ConnectionCloseHttps", + "ConnectionCloseHttpsHttpSys", + "ConnectionCloseHttpSys", + "Fortunes", + "FortunesDapper", + "FortunesEf", + "FortunesPlatform", + "FortunesPlatformDapper", + "FortunesPlatformEF", + "Json", + "JsonHttps", + "JsonHttpsHttpSys", + "JsonMin", + "JsonMvc", + "MultipleQueriesPlatform", + "PlaintextMvc", + "PlaintextQueryString", + "PlaintextWithParametersEmptyFilter", + "PlaintextWithParametersNoFilter", + "SingleQueryPlatform", + "Stage1", + "Stage1Grpc", + "Stage2", + "UpdatesPlatform" +); + +List scoutList2 = scoutList.Concat(ML("CachingPlatform", "JsonMapAction", "Stage1TrimR2RSingleFile")).ToList(); +List smallList = ML("Fortunes", "JsonHttpsHttpSys", "PlaintextQueryString", "Stage2", "PlaintextMvc"); diff --git a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Utils.dib b/src/benchmarks/gc/GC.Infrastructure/Notebooks/Utils.dib deleted file mode 100644 index 8212af2ea12..00000000000 --- a/src/benchmarks/gc/GC.Infrastructure/Notebooks/Utils.dib +++ /dev/null @@ -1,26 +0,0 @@ -#!meta - -{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"languageName":"csharp","name":"csharp"}]}} - -#!csharp - -// ML and MA are convenience syntax for making lists and arrays. -public static List ML(params T[] elems) => new List(elems); -public static T[] MA(params T[] elems) => elems; - -public static V GetOrAdd(this Dictionary dict, K key, V value) - => dict.TryAdd(key, value) ? value : dict[key]; - -public static void SetWithExtend(this List list, int index, T value) -{ - int count = list.Count; - int needed = index + 1; - for (int i = 0; i < (needed - count); ++i) - { - list.Add(default(T)); - } - list[index] = value; -} - -public static IEnumerable<(T, int)> WithIndex(this IEnumerable list) => list.Select((value, index) => (value, index)); -public static bool NotNull(T x) => x != null;