提交 e03ef29a 编写于 作者: V vkempik

8058935: CPU detection gives 0 cores per cpu, 2 threads per core in Amazon EC2 environment

Reviewed-by: kvn, dsamersoff
上级 023f1d63
...@@ -570,10 +570,12 @@ public: ...@@ -570,10 +570,12 @@ public:
static uint cores_per_cpu() { static uint cores_per_cpu() {
uint result = 1; uint result = 1;
if (is_intel()) { if (is_intel()) {
if (supports_processor_topology()) { bool supports_topology = supports_processor_topology();
if (supports_topology) {
result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus / result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
_cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus; _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else { }
if (!supports_topology || result == 0) {
result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1); result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
} }
} else if (is_amd()) { } else if (is_amd()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册