feat(diagnostics): VM emits trace events + CallScriptDispatches stat
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Age.Engine.Diagnostics;
|
||||
using Age.Engine.Hosting;
|
||||
using Age.Engine.Model;
|
||||
|
||||
@@ -36,3 +38,14 @@ internal sealed class AnyProvider : IScriptProvider
|
||||
public AnyProvider(Script s) => _s = s;
|
||||
public Script? GetById(long id) => _s;
|
||||
}
|
||||
|
||||
/// <summary>Captures every trace event for assertions; TracingSteps is settable so a test can
|
||||
/// exercise the Step gate both ways.</summary>
|
||||
internal sealed class RecordingTraceSink : ITraceSink
|
||||
{
|
||||
public bool TracingSteps { get; init; }
|
||||
public readonly List<TraceEvent> Events = new();
|
||||
public void Emit(in TraceEvent e) => Events.Add(e);
|
||||
public List<long> CallScriptIds =>
|
||||
Events.Where(e => e.Kind == TraceEventKind.CallScript).Select(e => e.Id).ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user