https://bugs.kde.org/show_bug.cgi?id=434922

--- Comment #19 from Matteo <mat...@matteopiscitelli.it> ---
Sorry, in previous snippet from linuxcpuplugin.cpp I missed to report the outer
loop closing rows. Here complete snippet is, for clarity:

```
    for (QByteArray line = cpuinfo.readLine(); !line.isEmpty(); line =
cpuinfo.readLine()) {
        CpuInfo info;
        // Processors are divided by empty lines
        for (; line != "\n";  line = cpuinfo.readLine()) {
            // we are interested in processor number as identifier for
/proc/stat, physical id (the
            // cpu the core belongs to) and the number of the core. However
with hyperthreading
            // multiple entries will have the same combination of physical id
and core id. So we just
            // count up the core number. For mapping temperature both ids are
still needed nonetheless.
            const int delim = line.indexOf(":");
            const QByteArray field = line.left(delim).trimmed();
            const QByteArray value = line.mid(delim + 1).trimmed();
            if (field == "processor") {
                info.id = value.toInt();
            } else if (field == "physical id") {
                info.cpu = value.toInt();
            } else if (field == "core id") {
                info.core = value.toInt();
            } else if (field == "cpu MHz") {
                info.frequency = value.toDouble();
            } else if (field == "siblings") {
                info.siblings = value.toInt();
            }
        }

        cpus.push_back(info);
        cpuCount = std::max(cpuCount, info.cpu);
    }
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to