Vixen
02b45cc4
csharp
public interface IProcessorTopology

How many processors there are, of what kind, and whether we may choose.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

This is the contract half of the thread-pinning work that docs/plan/03 deferred out of Vixen.Core.Threading — the job scheduler cannot ask about cores without something like this, and it could not depend on a platform layer that did not exist. It stays a query with a fallback rather than an assumption: TrySetAffinity returning is the normal answer in a browser, under a container CPU quota, and on macOS, which offers quality-of-service classes instead of affinity masks and is right to.

AvailableProcessors is the number to size a worker pool from, not ProcessorCount: in a container the two differ, and spawning sixty-four workers against a two-core quota produces a job system that spends its time being descheduled.

Fields and properties (4)

  • int AvailableProcessors

    How many logical processors this process may actually run on.

  • int PhysicalCores

    How many physical cores there are, or AvailableProcessors where the platform does not distinguish.

  • int PerformanceCores

    How many performance cores there are, or 0 where the platform does not say.

  • bool SupportsAffinity

    Whether TrySetAffinity can do anything on this platform.

Methods (3)

  • ProcessorClass ClassOf(int processor)

    What kind of core a logical processor sits on.

  • bool TrySetAffinity(int processor)

    Pins the calling thread to one logical processor.

  • void ClearAffinity()

    Undoes a previous TrySetAffinity for the calling thread.

Used by (15)

  • AppBuilderVixen.App.Hosting
  • DesktopPlatformVixen.Platform.Desktop
  • DesktopPlatformTestsVixen.Platform.Desktop.Tests
  • DesktopProcessorTopologyVixen.Platform.Desktop
  • HeadlessLifecycleTestsVixen.Platform.Headless.Tests
  • HeadlessPlatformVixen.Platform.Headless
  • HeadlessProcessorTopologyVixen.Platform.Headless
  • IPlatformVixen.Platform
  • LinuxProcessorTopologyVixen.Platform.Linux
  • MacOSProcessorTopologyVixen.Platform.MacOS
  • NothingProcessorTopologyVixen.Platform.MacOS.Tests
  • NothingProcessorTopologyVixen.Platform.Desktop.Tests
  • PlatformServicesVixen.Platform
  • RecordingSupplementVixen.Platform.Desktop.Tests
  • WindowsProcessorTopologyVixen.Platform.Windows