Support Kingston read writes on non 32mib models

This commit is contained in:
Spiros
2024-06-03 18:26:49 +03:00
parent 03b1e15af6
commit 7982a35f9d

View File

@@ -216,6 +216,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
{ {
QJsonArray attributes = localObj["ata_smart_attributes"].toObject()["table"].toArray(); QJsonArray attributes = localObj["ata_smart_attributes"].toObject()["table"].toArray();
QJsonObject nvmeLog = localObj["nvme_smart_health_information_log"].toObject(); QJsonObject nvmeLog = localObj["nvme_smart_health_information_log"].toObject();
QString modelFamily = localObj["model_family"].toString();
QString modelName = localObj["model_name"].toString(); QString modelName = localObj["model_name"].toString();
QString firmwareVersion = localObj["firmware_version"].toString(); QString firmwareVersion = localObj["firmware_version"].toString();
float userCapacityGB = localObj.value("user_capacity").toObject().value("bytes").toDouble() / 1e9; float userCapacityGB = localObj.value("user_capacity").toObject().value("bytes").toDouble() / 1e9;
@@ -292,7 +293,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30)); unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
unsigned long long totalGbWritten = (lbaWritten * logicalBlockSize) / oneGB; unsigned long long totalGbWritten = (lbaWritten * logicalBlockSize) / oneGB;
totalWrites = QString::number(static_cast<int>(totalGbWritten)) + " GB"; totalWrites = QString::number(static_cast<int>(totalGbWritten)) + " GB";
} else if (attrObj["name"] == "Host_Writes_GiB") { // WD uses GiB } else if (attrObj["name"] == "Host_Writes_GiB" || attrObj["name"] == "Lifetime_Writes_GiB") {
double gibibytes = attrObj["raw"].toObject()["value"].toDouble(); double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
double bytesPerGiB = static_cast<double>(1ULL << 30); double bytesPerGiB = static_cast<double>(1ULL << 30);
double bytesPerGB = 1e9; double bytesPerGB = 1e9;
@@ -312,7 +313,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30)); unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
unsigned long long totalGbRead = (lbaRead * logicalBlockSize) / oneGB; unsigned long long totalGbRead = (lbaRead * logicalBlockSize) / oneGB;
totalReads = QString::number(static_cast<int>(totalGbRead)) + " GB"; totalReads = QString::number(static_cast<int>(totalGbRead)) + " GB";
} else if (attrObj["name"] == "Host_Reads_GiB") { } else if (attrObj["name"] == "Host_Reads_GiB" || attrObj["name"] == "Lifetime_Reads_GiB") {
double gibibytes = attrObj["raw"].toObject()["value"].toDouble(); double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
double bytesPerGiB = static_cast<double>(1ULL << 30); double bytesPerGiB = static_cast<double>(1ULL << 30);
double bytesPerGB = 1e9; double bytesPerGB = 1e9;