Parse Total LBAs for drives which seem to use Gigabytes

This commit is contained in:
Spiros
2025-05-22 00:13:42 +03:00
parent 3416cc7ac1
commit 9b7f4fb44e

View File

@@ -554,7 +554,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
qlonglong oneGB = static_cast<qlonglong>(std::pow(2, 30));
qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB;
totalWritesInt = static_cast<int>(gigabytes);
int gigabytesInt = static_cast<int>(gigabytes);
if (!gigabytesInt) {
gigabytesInt = static_cast<int>(lbaWritten);
}
totalWritesInt = gigabytesInt;
} else if (attrObj["name"] == "Host_Writes_GiB" || attrObj["name"] == "Lifetime_Writes_GiB") {
double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
double bytesPerGiB = static_cast<double>(1ULL << 30);
@@ -575,7 +579,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
qlonglong lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
qlonglong oneGB = static_cast<qlonglong>(std::pow(2, 30));
qlonglong gigabytes = (lbaRead * logicalBlockSize) / oneGB;
totalReadsInt = static_cast<int>(gigabytes);
int gigabytesInt = static_cast<int>(gigabytes);
if (!gigabytesInt) {
gigabytesInt = static_cast<int>(lbaRead);
}
totalReadsInt = gigabytesInt;
} else if (attrObj["name"] == "Host_Reads_GiB" || attrObj["name"] == "Lifetime_Reads_GiB") {
double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
double bytesPerGiB = static_cast<double>(1ULL << 30);