diff --git a/src/FiveStar.Loader/Shims/D3D12X/Pipelines/OnDemandPrograms.cs b/src/FiveStar.Loader/Shims/D3D12X/Pipelines/OnDemandPrograms.cs index 66efe84..8687d30 100644 --- a/src/FiveStar.Loader/Shims/D3D12X/Pipelines/OnDemandPrograms.cs +++ b/src/FiveStar.Loader/Shims/D3D12X/Pipelines/OnDemandPrograms.cs @@ -66,8 +66,10 @@ public string Summary var ready = Math.Max(1, Volatile.Read(ref _ready)); var average = TimeSpan.FromTicks(Interlocked.Read(ref _readyTicks) / ready).TotalSeconds; var slowest = TimeSpan.FromTicks(Interlocked.Read(ref _slowestTicks)).TotalSeconds; - var failed = _failures.Values.Sum(); - var causes = string.Join("; ", _failures.OrderByDescending(entry => entry.Value).Take(CausesShown).Select(entry => $"{entry.Value} {entry.Key}")); + // A snapshot: LINQ over the dictionary itself sizes an array by Count, then copies while workers add causes. + var failures = _failures.ToArray(); + var failed = failures.Sum(entry => entry.Value); + var causes = string.Join("; ", failures.OrderByDescending(entry => entry.Value).Take(CausesShown).Select(entry => $"{entry.Value} {entry.Key}")); return $"programs on demand: {_jobs.Count} asked for, {Volatile.Read(ref _made)} translated and compiled, {Volatile.Read(ref _found)} found compiled{_compilerCounts?.Invoke()}, ready after {average:F1} s on average and {slowest:F0} s at most, {failed} failed ({causes}), {_workers.Backlog} queued, {_workers.Running} running, {_workers.WaitingForMemory} waiting for memory, {Links.Summary}"; } diff --git a/src/FiveStar.Loader/Shims/D3D12X/Pipelines/StandInPipelines.cs b/src/FiveStar.Loader/Shims/D3D12X/Pipelines/StandInPipelines.cs index 176d9fc..f8685ad 100644 --- a/src/FiveStar.Loader/Shims/D3D12X/Pipelines/StandInPipelines.cs +++ b/src/FiveStar.Loader/Shims/D3D12X/Pipelines/StandInPipelines.cs @@ -432,8 +432,11 @@ private void CountSkippedBefore(nint standIn) private string SkippedBeforeSummary() { - var total = _skippedBefore.Values.Sum(); - var top = string.Join(", ", _skippedBefore.OrderByDescending(entry => entry.Value).Take(SkipsShown).Select(entry => $"{entry.Key} x{entry.Value}")); + // A snapshot: LINQ over the dictionary itself sizes an array by Count, then copies while lists add entries + // (ArgumentException on the sampler thread, which ended a boot at 4,200 presents). + var entries = _skippedBefore.ToArray(); + var total = entries.Sum(entry => entry.Value); + var top = string.Join(", ", entries.OrderByDescending(entry => entry.Value).Take(SkipsShown).Select(entry => $"{entry.Key} x{entry.Value}")); return $"{total} lists ran work after a skipped one ({top})"; }