-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
283 additions
and
6 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
...C.Infrastructure/GC.Infrastructure.Core.UnitTests/GC.Infrastructure.Core.UnitTests.csproj
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
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
246 changes: 246 additions & 0 deletions
246
src/benchmarks/gc/GC.Infrastructure/Notebooks/Examples/CustomTraceEventExample.ipynb
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,246 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Usage of GC.Analysis.API for GC Analysis" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"polyglot_notebook": { | ||
"kernelName": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"// In order to use a custom TraceEvent library, we need to reference it directly here\n", | ||
"\n", | ||
"#r \"C:\\Dev\\perfview\\src\\TraceEvent\\bin\\Release\\netstandard2.0\\Microsoft.Diagnostics.Tracing.TraceEvent.dll\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"#r \"nuget: XPlot.Plotly\"\n", | ||
"#r \"nuget: XPlot.Plotly.Interactive\"\n", | ||
"#r \"nuget: Microsoft.Data.Analysis\"\n", | ||
"#r \"nuget: Newtonsoft.Json\"\n", | ||
"\n", | ||
"using Etlx = Microsoft.Diagnostics.Tracing.Etlx;\n", | ||
"using Microsoft.Data.Analysis;\n", | ||
"using Microsoft.Diagnostics.Tracing.Analysis.GC;\n", | ||
"using Microsoft.Diagnostics.Tracing.Analysis;\n", | ||
"using Microsoft.Diagnostics.Tracing.Parsers.Clr;\n", | ||
"using Microsoft.Diagnostics.Tracing;\n", | ||
"using XPlot.Plotly;\n", | ||
"\n", | ||
"using System.IO;\n", | ||
"using Newtonsoft.Json;" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Building and Using The GC Analysis API" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Before building `GC.Analysis.API`, make sure we change the project file so that it references the local copy instead of pulling it from Nuget. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "pwsh" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"dotnet build -c Release \"..\\..\\GC.Analysis.API\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"#r \"C:\\performance\\artifacts\\bin\\GC.Analysis.API\\Release\\net8.0\\GC.Analysis.API.dll\" \n", | ||
"\n", | ||
"using GC.Analysis.API;" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Creating the Analyzer" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"var TRACE_PATH = @\".\\Traces\\gccollectonly.etl.zip\";" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Get Analyzer From a Single Path" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Get All Processes From a Trace" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"Analyzer gcTraceData = new Analyzer(tracePath: TRACE_PATH);" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Get Select Processes From a Trace" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"gcTraceData.SummarizeTrace(processName: \"corerun\")" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Getting To a ``List<TraceGC>`` from the Trace Data For a Process" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "csharp" | ||
}, | ||
"vscode": { | ||
"languageId": "polyglot-notebook" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"List<GCProcessData> corerunData = gcTraceData.GetProcessGCData(processName: \"corerun\");\n", | ||
"GCProcessData corerunToInvestigate = corerunData[0];\n", | ||
"List<TraceGC> traceGCs = corerunToInvestigate.GCs;" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".NET (C#)", | ||
"language": "C#", | ||
"name": ".net-csharp" | ||
}, | ||
"language_info": { | ||
"file_extension": ".cs", | ||
"mimetype": "text/x-csharp", | ||
"name": "C#", | ||
"pygments_lexer": "csharp", | ||
"version": "9.0" | ||
}, | ||
"orig_nbformat": 4, | ||
"polyglot_notebook": { | ||
"kernelInfo": { | ||
"defaultKernelName": "csharp", | ||
"items": [ | ||
{ | ||
"aliases": [], | ||
"name": "csharp" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<!-- To use a custom TraceEvent library, specify CustomTraceEvent to true and the PerfViewPath below --> | ||
<CustomTraceEvent>false</CustomTraceEvent> | ||
<PerfViewPath>$(MSBuildProjectDirectory)\..\..\..\..\..\..\PerfView</PerfViewPath> | ||
<DefineConstants Condition="'$(CustomTraceEvent)' == 'true'">CUSTOM_TRACE_EVENT;$(DefineConstants)</DefineConstants> | ||
</PropertyGroup> | ||
</Project> |