public sealed class ProfilerModelThe half of the profiler panel that is not chrome.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Which source is selected, whether it is recording, what the last capture holds, and what it is being compared against — none of which needs a UiDocument to be right. The same split ConsoleModel makes, for the same reason: the decisions worth testing are all here and the view is bars and buttons over them.
⚠ Recording accumulates rather than replacing. Profiler.Collect empties the rings, so a model that rebuilt the capture from each tick's collect would show only the last sixteen milliseconds — and a capture button that produced a sixteen-millisecond window is one nobody can use. Samples are gathered across every tick between Start and Stop and become one capture at the end.
⚠ The rings are drained while recording even though nothing draws them yet. They overwrite when full, so a five-second capture of a busy thread would otherwise be the last sixty milliseconds of it with the rest silently gone. Draining per tick is what makes a long capture a long capture.
Fields and properties (10)
public IReadOnlyList<IProfileSource> SourcesThe sources that can be profiled, in the order they were added.
public IProfileSource? SelectedWhich one is selected, or when none has been added.
public ProfilerState StateWhether it is sampling.
public ProfileCapture CaptureThe most recent finished capture.
public ProfileCapture? BaselineWhat Capture is being compared against, or .
public IReadOnlyList<ProfileDelta> DeltasThe comparison, or an empty list when there is no baseline.
public int ThreadWhich thread's chart is on screen, by index into the capture's threads.
public int? FrameWhich frame of the capture the chart is showing, or for all of them.
public ProfileThread? CurrentThe thread whose chart is on screen, or when there is none.
public IReadOnlyList<FlameNode> RootsThe roots the chart should draw, honouring Frame.
Events (1)
public Action<ProfilerModel>? ChangedRaised when the capture, the state or the selection changed.
Methods (7)
public void Add(IProfileSource source)Adds a source.
public bool Remove(IProfileSource source)Removes a source, stopping the capture if it was the one being recorded.
public void Start()Starts sampling into a fresh capture.
public void Tick()Takes whatever has been sampled since the last call.
public void Stop()Stops sampling and turns what was gathered into a capture.
public void MarkBaseline()Makes the current capture the thing later captures are compared against.
public void ClearBaseline()Forgets the baseline.
Used by (5)
- DiagnosticsModuleVixen.Editor.Diagnostics
- DiagnosticsPanelTestsVixen.Editor.App.Tests
- EditorApplicationVixen.Editor.App
- ProfilerModelTestsVixen.Editor.Profiler.Tests
- ProfilerViewVixen.Editor.Profiler