Skip to content

Commit

Permalink
Redo factoring. Simplify into just DataManager and Reports.
Browse files Browse the repository at this point in the history
Fixes type conversion/lambda issue.  Includes instructions for
iterating on Reports.
  • Loading branch information
markples committed Jul 3, 2024
1 parent b9e3256 commit 10fd2a3
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Workflow HERE!!!

Check failure on line 1 in src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md

View workflow job for this annotation

GitHub Actions / lint

Trailing punctuation in heading [Punctuation: '!!!']

# Benchmark Analysis

Check failure on line 3 in src/benchmarks/gc/GC.Infrastructure/Notebooks/BenchmarkAnalysis.md

View workflow job for this annotation

GitHub Actions / lint

Multiple top-level headings in the same document [Context: "# Benchmark Analysis"]

Expand Down
42 changes: 40 additions & 2 deletions src/benchmarks/gc/GC.Infrastructure/Notebooks/DataManager.dib
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> ML<T>(params T[] elems) => new List<T>(elems);
public static T[] MA<T>(params T[] elems) => elems;

public static V GetOrAdd<K,V>(this Dictionary<K,V> dict, K key, V value)
=> dict.TryAdd(key, value) ? value : dict[key];

public static void SetWithExtend<T>(this List<T> 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<T>(this IEnumerable<T> list) => list.Select((value, index) => (value, index));
public static bool NotNull<T>(T x) => x != null;

#!csharp

// Data Acquisition
Expand Down
46 changes: 0 additions & 46 deletions src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Data.dib

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
23 changes: 0 additions & 23 deletions src/benchmarks/gc/GC.Infrastructure/Notebooks/Reports-Imports.dib

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
// -----------------------------------------------

Expand Down Expand Up @@ -479,7 +490,7 @@ public class Metric<TSource> : BaseMetric<TSource, double?>
public static class Metrics
{
public static Metric<IterationData> Promote(Metric<TraceGC> metric, Aggregation aggregation)
=> Metric<IterationData>.Promote(metric, iterationData => (IEnumerable<TraceGC>)iterationData.GCProcessData.GCs, aggregation);
=> Metric<IterationData>.Promote(metric, iterationData => iterationData.GCProcessData.GCs, aggregation);
public static Metric<BenchmarkData> Promote(Metric<IterationData> metric, Aggregation aggregation)
=> Metric<BenchmarkData>.Promote(metric, benchmarkData => benchmarkData.Iterations, aggregation);
public static Metric<ConfigData> Promote(Metric<BenchmarkData> metric, Aggregation aggregation)
Expand Down Expand Up @@ -885,7 +896,7 @@ class TraceGCChartType : ChartType<TraceGC>

public override List<KeyValuePair<string, TraceGC>> GetDataSource(SeriesInfo<TraceGC> info,
Filter benchmarkFilter, IntFilter iterationFilter, ConfigIterationFilter configIterationFilter, Func<TraceGC, bool> dataFilter)
=> ((IEnumerable<TraceGC>)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<XValue>, IEquatable<XValue>
Expand Down Expand Up @@ -1754,3 +1765,46 @@ List<PlotlyChart> ChartGCData(DataManager dataManager, Metric<TraceGC> 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<string> 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<string> scoutList2 = scoutList.Concat(ML("CachingPlatform", "JsonMapAction", "Stage1TrimR2RSingleFile")).ToList();
List<string> smallList = ML("Fortunes", "JsonHttpsHttpSys", "PlaintextQueryString", "Stage2", "PlaintextMvc");
26 changes: 0 additions & 26 deletions src/benchmarks/gc/GC.Infrastructure/Notebooks/Utils.dib

This file was deleted.

0 comments on commit 10fd2a3

Please sign in to comment.