Files
HellionChat/HellionChat/SelfTests/PerformanceBaselineStep.cs
T
JonKazama-Hellion 0109bfd222 test(selftests): add v1.6.0 SelfTest steps from sub-spec
Six new ISelfTestStep entries register with the Dalamud SelfTestRegistry:
SidebarModeAutoSwitch probes the width threshold both above and below the
exact boundary so the >= contract stays pinned; ColorEditorBuffer is a
placeholder until the picker arrives; ConfigMigrationV20 asserts the
schema stamp and the five v20 field defaults; HoverSheenAlloc drives 100
hovered frames against three constant keys and a final un-hover sweep to
exercise the cleanup branch; HonorificHeaderRender runs one Draw call on
the live component to catch IPC fallback crashes; PerformanceBaseline
prints a JSON line of the IO counters so the cycle notes can pick up a
snapshot. MainWindow gets internal accessors so the probes can reach the
sidebar and honorific header without widening the public surface.
2026-05-23 20:35:01 +02:00

46 lines
1.6 KiB
C#

using System.Diagnostics;
using Dalamud.Bindings.ImGui;
using Dalamud.Plugin.SelfTest;
namespace HellionChat.SelfTests;
// Optional metric capture. Walks one frame's ImGui IO counters and
// prints a single JSON block so the cycle-notes author can copy/paste
// the snapshot without standing up a separate profiling harness.
// Investigations themselves are deferred to the polish cycle — this
// step only records, it never fails on threshold.
internal sealed class PerformanceBaselineStep : ISelfTestStep
{
public PerformanceBaselineStep(Plugin plugin)
{
_ = plugin;
}
public string Name => "Hellion Chat - Performance baseline capture";
public SelfTestStepResult RunStep()
{
var io = ImGui.GetIO();
var stopwatch = Stopwatch.StartNew();
// No actual probe — we just sample the counters that ImGui keeps
// updated each frame. Stopwatch is started so the JSON line
// includes a non-zero wall-time figure even when ImGui has not
// accumulated frame stats yet.
stopwatch.Stop();
ImGui.Text(
"{ "
+ $"\"renderVertices\": {io.MetricsRenderVertices}, "
+ $"\"renderIndices\": {io.MetricsRenderIndices}, "
+ $"\"renderWindows\": {io.MetricsRenderWindows}, "
+ $"\"activeWindows\": {io.MetricsActiveWindows}, "
+ $"\"deltaTimeMs\": {io.DeltaTime * 1000f:F2}, "
+ $"\"sampleWallTimeMs\": {stopwatch.Elapsed.TotalMilliseconds:F2}"
+ " }"
);
return SelfTestStepResult.Pass;
}
public void CleanUp() { }
}