Commit fbefa252 authored by David Redondo's avatar David Redondo 🏎
Browse files

Fix disk speeds

Classical case of off-by-one. The documentation starts numbering at one.
I used the numbers from it instead of the proper ones.
BUG:432637


(cherry picked from commit 34705df7)
parent 5f3ea78b
......@@ -300,16 +300,16 @@ void DisksPlugin::update()
The /proc/diskstats file displays the I/O statistics
of block devices. Each line contains the following 14
fields:
1 - major number
2 - minor mumber
3 - device name
4 - reads completed successfully
5 - reads merged
6 - sectors read
7 - time spent reading (ms)
8 - writes completed
9 - writes merged
10 - sectors written
- major number
- minor mumber
- device name
- reads completed successfully
- reads merged
- sectors read
- time spent reading (ms)
- writes completed
- writes merged
- sectors written
[...]
*/
for (QByteArray line = diskstats.readLine(); !line.isNull(); line = diskstats.readLine()) {
......@@ -317,7 +317,7 @@ void DisksPlugin::update()
const QString device = QStringLiteral("/dev/%1").arg(QString::fromLatin1(fields[2]));
if (m_volumesByDevice.contains(device)) {
// A sector as reported in diskstats is 512 Bytes, see https://stackoverflow.com/a/38136179
m_volumesByDevice[device]->setBytes(fields[6].toULongLong() * 512, fields[10].toULongLong() * 512, elapsed);
m_volumesByDevice[device]->setBytes(fields[5].toULongLong() * 512, fields[9].toULongLong() * 512, elapsed);
}
}
#elif defined Q_OS_FREEBSD
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment