Vixen
02b45cc4
csharp
public static class TraceExporter

Writes collected samples as a Chrome trace_event JSON document, which opens directly in ui.perfetto.dev and in chrome://tracing.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A deliberate choice not to build a viewer. Perfetto's is better than anything this project would write, it handles multi-gigabyte traces, and it already understands nested scopes, multiple threads and counter tracks. The engine's job is to produce a file it can read.

The JSON form is the fallback that every tool accepts. Perfetto's protobuf format is smaller and streams, and is worth adding when trace size becomes the problem — it needs a protobuf dependency, and picking one up to save bytes nobody has yet measured would be the wrong order.

Methods (3)

  • public static void WriteChromeTrace(IReadOnlyList<ProfilerThreadSamples> threads, Stream destination)

    Writes a trace document for the given samples.

  • public static void WriteChromeTrace(IReadOnlyList<ProfilerThreadSamples> threads, string path)

    Writes a trace document to a file.

  • public static string Summarize(IReadOnlyList<ProfilerThreadSamples> threads)

    Renders collected samples as a text summary: total and average time per key, worst first. What a headless run or a CI log wants, where nobody is going to open a trace viewer.

Used by (1)

  • DiagnosticsTestsVixen.Core.Diagnostics.Tests