Vixen
02b45cc4
csharp
public sealed class FlameNode

One scope in a flame chart: a sample, what ran inside it, and where it draws.

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

Remarks

The tree the rings do not keep. A ProfilerSample carries a depth and two timestamps and nothing about its parent — which is exactly right for the recording side, where a parent pointer would be a second store on the hot path. Rebuilding the nesting is a walk over the samples in begin order, and it happens once per capture rather than once per frame.

⚠ Samples arrive in completion order, not in begin order. A scope is recorded when it closes, so a parent lands in the ring after every child it contains — which means the obvious reading of the array builds every tree upside down. Build sorts before it walks, and that sort is the whole trick.

Fields and properties (9)

  • public ProfilerSample Sample

    The scope itself.

  • public int Level

    Which row it draws on, counting from zero at the root.

  • public IReadOnlyList<FlameNode> Children

    What ran inside it, in begin order.

  • public string Name

    What it is called.

  • public double Milliseconds

    How long it ran, in milliseconds.

  • public double SelfMilliseconds

    How long it ran with its children's time taken out, in milliseconds.

  • public long EndTicks

    When it ended, in Stopwatch ticks.

  • public int Count

    How many nodes are in this subtree, including this one.

  • public int Height

    How many rows deep this subtree goes.

Methods (3)

  • public static IReadOnlyList<FlameNode> Build(ProfilerSample[] samples)

    Rebuilds one thread's nesting from its flat samples.

  • public void Walk(Action<FlameNode> visit)

    Calls on this node and everything under it, parents first.

  • public override string ToString()

    Returns a string that represents the current object.

Used by (8)

  • FlameChartViewVixen.Editor.Profiler
  • FlameChartViewTestsVixen.Editor.Profiler.Tests
  • FlameTreeTestsVixen.Editor.Profiler.Tests
  • ProfileCaptureVixen.Editor.Profiler
  • ProfileSummaryVixen.Editor.Profiler
  • ProfileThreadVixen.Editor.Profiler
  • ProfilerModelVixen.Editor.Profiler
  • ProfilerViewVixen.Editor.Profiler