* [Libc] routed strcasecmp through HLE * [Ampr] implemented command buffer streaming contract * [Agc] completed command buffer operations * [Kernel] added wide string formatting coverage * [VideoOut] added output mode events and profiling fixes * [Shader] expanded Gen5 resource and interpolation support * [Gpu] fixed image, render, and dispatch handling * [Memory] added guest address space pre-reservation * [AMPR] deferred read file execution to command submission * [SpirvTranslator] Add DsMinF32 and DsMaxF32 instructions * [spirvtranslator] Added V_CMPX_NE_U64 instruction * [spirvtranslator] added DsReadI8 instruction * [test] fixed
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
// Copyright (C) 2026 SharpEmu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
using SharpEmu.Libs.VideoOut;
|
|
using Xunit;
|
|
|
|
namespace SharpEmu.Libs.Tests.VideoOut;
|
|
|
|
public sealed class RenderPhaseProfileTests
|
|
{
|
|
[Fact]
|
|
public void DisabledDetailMeasurement_DoesNotAllocateOnANewThread()
|
|
{
|
|
if (RenderPhaseProfile.Enabled) return;
|
|
|
|
long allocated = -1;
|
|
var thread = new Thread(() =>
|
|
{
|
|
var before = GC.GetAllocatedBytesForCurrentThread();
|
|
using (RenderPhaseProfile.MeasureDetail(RenderPhaseProfile.Phase.ImageTracking))
|
|
{
|
|
}
|
|
allocated = GC.GetAllocatedBytesForCurrentThread() - before;
|
|
}) { IsBackground = true };
|
|
thread.Start();
|
|
Assert.True(thread.Join(TimeSpan.FromSeconds(30)));
|
|
Assert.Equal(0, allocated);
|
|
}
|
|
|
|
[Fact]
|
|
public void DetailMeasurement_PreservesTheOuterScope()
|
|
{
|
|
Assert.False(RenderPhaseProfile.DetailMeasurementsEnabled);
|
|
using (RenderPhaseProfile.Measure(RenderPhaseProfile.Phase.Draw))
|
|
{
|
|
Assert.Equal(RenderPhaseProfile.Enabled, RenderPhaseProfile.DetailMeasurementsEnabled);
|
|
using (RenderPhaseProfile.MeasureDetail(RenderPhaseProfile.Phase.ImageTracking))
|
|
Assert.Equal(RenderPhaseProfile.Enabled, RenderPhaseProfile.DetailMeasurementsEnabled);
|
|
Assert.Equal(RenderPhaseProfile.Enabled, RenderPhaseProfile.DetailMeasurementsEnabled);
|
|
}
|
|
Assert.False(RenderPhaseProfile.DetailMeasurementsEnabled);
|
|
}
|
|
}
|