GithubHelp home page GithubHelp logo

gresau / gresau.tracing Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 21 KB

Easy performance tracing for .NET Core 3

Home Page: https://www.nuget.org/packages/GREsau.Tracing

License: MIT License

C# 100.00%
csharp performance netcore3

gresau.tracing's Introduction

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's People

Contributors

gresau avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.