GREsau.Tracing 0.2.0

Easy performance tracing for .NET Core

Install-Package GREsau.Tracing -Version 0.2.0
dotnet add package GREsau.Tracing --version 0.2.0
<PackageReference Include="GREsau.Tracing" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GREsau.Tracing --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

GREsau.Tracing

GREsau.Tracing is a library to perform performance tracing of .NET Core applications. Essentially, it 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 library makes use of Microsoft.Diagnostics.NETCore.Client. If you're looking for something more powerful/flexible and you're willing to accept the complexity that comes with that, consider using that library directly.

Installing

Install via NuGet:

>  dotnet add package GREsau.Tracing

Basic Usage

To trace the current process for a period of time, saving the output 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(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.NETCore.Client.EventPipeProviders:

var gcCollectProvider = new EventPipeProvider(
    "Microsoft-Windows-DotNETRuntime",
    EventLevel.Informational,
    (long)(ClrTraceEventParser.Keywords.GC | ClrTraceEventParser.Keywords.Exception));
var client = new TraceClient(providers: new[] { gcCollectProvider });
await client.CollectAsync("trace.nettrace", TimeSpan.FromMinutes(1));

GREsau.Tracing

GREsau.Tracing is a library to perform performance tracing of .NET Core applications. Essentially, it 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 library makes use of Microsoft.Diagnostics.NETCore.Client. If you're looking for something more powerful/flexible and you're willing to accept the complexity that comes with that, consider using that library directly.

Installing

Install via NuGet:

>  dotnet add package GREsau.Tracing

Basic Usage

To trace the current process for a period of time, saving the output 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(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.NETCore.Client.EventPipeProviders:

var gcCollectProvider = new EventPipeProvider(
    "Microsoft-Windows-DotNETRuntime",
    EventLevel.Informational,
    (long)(ClrTraceEventParser.Keywords.GC | ClrTraceEventParser.Keywords.Exception));
var client = new TraceClient(providers: new[] { gcCollectProvider });
await client.CollectAsync("trace.nettrace", TimeSpan.FromMinutes(1));

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.2.0 72 12/9/2019
0.1.0 102 11/25/2019