diff options
Diffstat (limited to 'Source/kwsys/SystemInformation.cxx')
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 5f20853..9c26380 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -4698,11 +4698,28 @@ bool SystemInformationImplementation::QueryHaikuInfo() { #if defined(__HAIKU__) + // CPU count system_info info; get_system_info(&info); - this->NumberOfPhysicalCPU = info.cpu_count; - this->CPUSpeedInMHz = info.cpu_clock_speed / 1000000.0F; + + // CPU speed + uint32 topologyNodeCount = 0; + cpu_topology_node_info* topology = 0; + get_cpu_topology_info(0, &topologyNodeCount); + if (topologyNodeCount != 0) + topology = new cpu_topology_node_info[topologyNodeCount]; + get_cpu_topology_info(topology, &topologyNodeCount); + + for (uint32 i = 0; i < topologyNodeCount; i++) { + if (topology[i].type == B_TOPOLOGY_CORE) { + this->CPUSpeedInMHz = topology[i].data.core.default_frequency / + 1000000.0f; + break; + } + } + + delete[] topology; // Physical Memory this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ; |