test: stabilize load-sensitive release contracts
This commit is contained in:
parent
c8c764a40e
commit
dfc841b779
8 changed files with 199 additions and 43 deletions
|
|
@ -63,6 +63,8 @@ public sealed class StreamingController
|
|||
_isPublicationBlockedByRetirement;
|
||||
private readonly StreamingWorkBudgetOptions _configuredWorkBudgetOptions;
|
||||
private StreamingWorkBudget _workBudget;
|
||||
private readonly Func<long> _workTimestamp;
|
||||
private readonly long _workTimestampFrequency;
|
||||
private StreamingWorkMeter? _activeWorkMeter;
|
||||
private StreamingWorkMeterSnapshot _lastWorkMeter;
|
||||
private readonly StreamingCompletionQueue _completionQueue = new();
|
||||
|
|
@ -376,6 +378,37 @@ public sealed class StreamingController
|
|||
LandblockPresentationPipeline presentationPipeline,
|
||||
Action? clearPendingLoads = null,
|
||||
StreamingWorkBudgetOptions? workBudgetOptions = null)
|
||||
: this(
|
||||
enqueueLoad,
|
||||
enqueueUnload,
|
||||
completionSource,
|
||||
state,
|
||||
nearRadius,
|
||||
farRadius,
|
||||
presentationPipeline,
|
||||
Stopwatch.GetTimestamp,
|
||||
Stopwatch.Frequency,
|
||||
clearPendingLoads,
|
||||
workBudgetOptions)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deterministic meter-clock seam for scheduler policy tests. Production
|
||||
/// construction always uses the public overload and <see cref="Stopwatch"/>.
|
||||
/// </summary>
|
||||
internal StreamingController(
|
||||
Action<uint, LandblockStreamJobKind, ulong> enqueueLoad,
|
||||
Action<uint, ulong> enqueueUnload,
|
||||
ILandblockCompletionSource completionSource,
|
||||
GpuWorldState state,
|
||||
int nearRadius,
|
||||
int farRadius,
|
||||
LandblockPresentationPipeline presentationPipeline,
|
||||
Func<long> workTimestamp,
|
||||
long workTimestampFrequency,
|
||||
Action? clearPendingLoads = null,
|
||||
StreamingWorkBudgetOptions? workBudgetOptions = null)
|
||||
{
|
||||
_enqueueLoad = enqueueLoad;
|
||||
_enqueueUnload = enqueueUnload;
|
||||
|
|
@ -390,6 +423,11 @@ public sealed class StreamingController
|
|||
_configuredWorkBudgetOptions =
|
||||
workBudgetOptions ?? StreamingWorkBudgetOptions.Default;
|
||||
_workBudget = _configuredWorkBudgetOptions.ToBudget();
|
||||
_workTimestamp = workTimestamp
|
||||
?? throw new ArgumentNullException(nameof(workTimestamp));
|
||||
if (workTimestampFrequency <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(workTimestampFrequency));
|
||||
_workTimestampFrequency = workTimestampFrequency;
|
||||
if (!_presentation.MatchesState(_state))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
|
|
@ -679,6 +717,8 @@ public sealed class StreamingController
|
|||
_configuredWorkBudgetOptions
|
||||
.HoldDestinationCeilingMilliseconds)
|
||||
: _workBudget,
|
||||
_workTimestamp,
|
||||
_workTimestampFrequency,
|
||||
destinationReservationActive: destinationHold);
|
||||
_activeWorkMeter = meter;
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue