Package deepnetts.util
Class PhysicalCores
java.lang.Object
deepnetts.util.PhysicalCores
Static utility class for finding the number of physical CPU cores.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Integer
Returns the number of "physical" hardware threads available.
-
Method Details
-
physicalCoreCount
Returns the number of "physical" hardware threads available. On a machien with hyper threading, this value may be less than the number reported by
Runtime.availableProcessors()
. If you are running on a virtual machine, the value returned will be the number of cores assigned to the VM, not the actual number of physical cores on the machine. Likewise, if the number of cores available to this process is less than the installed number, the available number will be returned.The first call to the method may take a long time, especially on Windows. Subsequent calls will return a cached value. The method is threadsafe.
- Returns:
- number of physical cores, or
null
if it could not be determined
-