mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-21 15:57:25 -06:00
use 'processor' field in /proc/cpuinfo to calculate thread count
This fixes too few nodes appearing for CPUs that have more than one thread per core
This commit is contained in:
parent
29c7f6df00
commit
00fa886e54
@ -85,7 +85,10 @@ std::vector<CPUData> fromCPUInfoData(std::vector<CPUInfoData> dataVec) {
|
||||
auto smallerCoreId = [](CPUInfoData a, CPUInfoData b) { return a.processor < b.processor; };
|
||||
std::vector<CPUData> retval;
|
||||
for (auto &cpu : cpus) {
|
||||
// These are actually threads, and not the 'core count' field,
|
||||
// since one core may have more than one thread, and threads are used in sysfs
|
||||
auto firstCore = minimum_by(smallerCoreId, cpu).processor;
|
||||
auto lastCore = fplus::maximum_by(smallerCoreId, cpu).processor;
|
||||
auto first = cpu.front();
|
||||
// Create identifier
|
||||
char identBuf[20];
|
||||
@ -93,7 +96,7 @@ std::vector<CPUData> fromCPUInfoData(std::vector<CPUInfoData> dataVec) {
|
||||
CPUData data{
|
||||
.identifier = identBuf,
|
||||
.firstCoreIndex = firstCore,
|
||||
.coreCount = first.cores,
|
||||
.coreCount = (lastCore - firstCore) + 1,
|
||||
.name = first.name,
|
||||
.cpuIndex = first.physicalId,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user