GREsau.Tracing
0.1.0
See the version list below for details.
dotnet add package GREsau.Tracing --version 0.1.0
NuGet\Install-Package GREsau.Tracing -Version 0.1.0
<PackageReference Include="GREsau.Tracing" Version="0.1.0" />
paket add GREsau.Tracing --version 0.1.0
#r "nuget: GREsau.Tracing, 0.1.0"
// Install GREsau.Tracing as a Cake Addin
#addin nuget:?package=GREsau.Tracing&version=0.1.0
// Install GREsau.Tracing as a Cake Tool
#tool nuget:?package=GREsau.Tracing&version=0.1.0
GREsau.Tracing
GREsau.Tracing is a simplified alternative to dotnet-trace, consumable as a C# library rather than a CLI tool.
GREsau.Tracing will only output nettrace
-format files. These can be viewed on Windows using PerfView, or converted to speedscope
-format using dotnet-trace's convert command, and then viewed at https://www.speedscope.app.
# Converts nettrace file to speedscope, writing to trace.speedscope.json
$ dotnet-trace convert --format Speedscope trace.nettrace
This package has a dependency on Microsoft.Diagnostics.Tools.RuntimeClient
, which is not yet available on NuGet (see dotnet/diagnostics#343). In the meantime, you can get it from the dotnet-core internal feed by adding the https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
NuGet source. This can be done by including this NuGet.Config file in your project:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
</packageSources>
</configuration>
Basic Usage
To trace the current process for a period of time, saving the file as "trace.nettrace":
var client = new TraceClient();
await client.CollectAsync("trace.nettrace", TimeSpan.FromMinutes(1));
You can also trace a different process by passing in its ID:
var client = new TraceClient(processId: 123);
await client.CollectAsync("trace.nettrace", TimeSpan.FromMinutes(1));
By default, TraceClient
will track CPU usage and general .NET runtime information, equivalent to running dotnet-trace with the cpu-sampling (default) profile. If you want to trace something different, you can pass in a collection of Microsoft.Diagnostics.Tools.RuntimeClient.Provider
s:
var gcCollectProvider = new Provider(
"Microsoft-Windows-DotNETRuntime",
(ulong)ClrTraceEventParser.Keywords.GC | (ulong)ClrTraceEventParser.Keywords.Exception,
EventLevel.Informational);
var client = new TraceClient(new[] { gcCollectProvider });
await client.CollectAsync("trace.nettrace", TimeSpan.FromMinutes(1));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
-
.NETCoreApp 3.0
- Microsoft.Diagnostics.Tools.RuntimeClient (>= 3.0.52901)
- Microsoft.Diagnostics.Tracing.TraceEvent (>= 2.0.48)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.