1 //go:build windows 2 3 package processorinfo 4 5 import ( 6 "runtime" 7 8 "github.com/Microsoft/hcsshim/internal/winapi" 9 ) 10 11 // ProcessorCount calls the win32 API function GetActiveProcessorCount 12 // to get the total number of logical processors on the system. If this 13 // fails it will fall back to runtime.NumCPU 14 func ProcessorCount() int32 { 15 if amount := winapi.GetActiveProcessorCount(winapi.ALL_PROCESSOR_GROUPS); amount != 0 { 16 return int32(amount) 17 } 18 return int32(runtime.NumCPU()) 19 } 20