public class PhysicalCores extends Object
Modifier and Type | Method and Description |
---|---|
static Integer |
physicalCoreCount()
Returns the number of "physical" hardware threads available.
|
public static Integer 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.
null
if it could not be determinedCopyright © 2022. All rights reserved.