Migrate Process tab manual affinity apply to CpuSelection (#16)

Migrate Process tab manual affinity apply to CpuSelection

Route manual Process tab affinity operations through a topology-aware coordinator so CpuSelection and CPU Sets are preferred over legacy long masks.

- Add ProcessAffinityApplyCoordinator for manual Process tab affinity apply
- Prefer CoreMask.CpuSelection when available
- Migrate legacy BoolMask selections to CpuSelection when topology is available
- Block unsafe legacy fallback for selections above CPU64
- Keep legacy long mask fallback only for safe single-group <=64 selections
- Wire SetAffinity, ApplyCoreMaskToProcessAsync and QuickApplyAffinityAndPowerPlan through the coordinator
- Document CoreMask.ToProcessorAffinity as legacy-only
- Ensure ProcessViewModel fallback coordinator receives topology provider
- Add regression tests for CPU64, multi-group, safe legacy fallback, migration and protected-process messages

No UI redesign, preset generator, memory priority, persistent rules engine, migration logic, version or tag changes.
This commit is contained in:
Prime Build
2026-05-20 22:25:34 +02:00
committed by GitHub
parent 5f9f7b5409
commit cbe2402f1b
7 changed files with 545 additions and 25 deletions
+8 -1
View File
@@ -45,6 +45,7 @@ namespace ThreadPilot.ViewModels
private readonly IProcessPowerPlanAssociationService associationService;
private readonly IGameModeService gameModeService;
private readonly IAffinityApplyService affinityApplyService;
private readonly IProcessAffinityApplyCoordinator processAffinityApplyCoordinator;
private System.Timers.Timer? refreshTimer;
private bool isUiRefreshPaused;
private bool isProcessViewActive = true;
@@ -177,6 +178,8 @@ namespace ThreadPilot.ViewModels
IProcessPowerPlanAssociationService associationService,
IGameModeService gameModeService,
IAffinityApplyService? affinityApplyService = null,
IProcessAffinityApplyCoordinator? processAffinityApplyCoordinator = null,
ICpuTopologyProvider? cpuTopologyProvider = null,
IEnhancedLoggingService? enhancedLoggingService = null)
: base(logger, enhancedLoggingService)
{
@@ -194,6 +197,11 @@ namespace ThreadPilot.ViewModels
this.processService,
this.cpuTopologyService,
NullLogger<AffinityApplyService>.Instance);
this.processAffinityApplyCoordinator = processAffinityApplyCoordinator ?? new ProcessAffinityApplyCoordinator(
this.affinityApplyService,
cpuTopologyProvider,
new CpuSelectionMigrationService(),
NullLogger<ProcessAffinityApplyCoordinator>.Instance);
// Subscribe to topology detection events
this.cpuTopologyService.TopologyDetected += this.OnTopologyDetected;
@@ -217,4 +225,3 @@ namespace ThreadPilot.ViewModels
}
}
}