mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-22 22:53:20 +03:00
Add nvme check before for loop
This commit is contained in:
@@ -195,41 +195,43 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
|||||||
powerOnHoursLineEdit->setText(powerOnTime);
|
powerOnHoursLineEdit->setText(powerOnTime);
|
||||||
powerOnHoursLineEdit->setAlignment(Qt::AlignRight);
|
powerOnHoursLineEdit->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
for (const QJsonValue &attr : attributes) { //Need different logic for NVMe
|
if (!isNvme) {
|
||||||
QJsonObject attrObj = attr.toObject();
|
for (const QJsonValue &attr : attributes) { //Need different logic for NVMe
|
||||||
if (attrObj["id"] == 241 && !isNvme) {
|
QJsonObject attrObj = attr.toObject();
|
||||||
if (attrObj["name"] == "Total_Writes_GB") {
|
if (attrObj["id"] == 241) {
|
||||||
totalWrites = QString::number(attrObj["raw"].toObject()["value"].toInt()) + " GB";
|
if (attrObj["name"] == "Total_Writes_GB") {
|
||||||
} else if (attrObj["name"] == "Host_Writes_32MiB") {
|
totalWrites = QString::number(attrObj["raw"].toObject()["value"].toInt()) + " GB";
|
||||||
double gibibytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
} else if (attrObj["name"] == "Host_Writes_32MiB") {
|
||||||
totalWrites = QString::number(static_cast<int>(gibibytes)) + " GB";
|
double gibibytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
||||||
} else if (attrObj["name"] == "Total_LBAs_Written") {
|
totalWrites = QString::number(static_cast<int>(gibibytes)) + " GB";
|
||||||
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
} else if (attrObj["name"] == "Total_LBAs_Written") {
|
||||||
unsigned long long lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
||||||
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
unsigned long long lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
||||||
unsigned long long totalGbWriten = (lbaWritten * logicalBlockSize) / oneGB;
|
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
||||||
totalWrites = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
unsigned long long totalGbWriten = (lbaWritten * logicalBlockSize) / oneGB;
|
||||||
}
|
totalWrites = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
||||||
} else if (attrObj["id"] == 242 && !isNvme) {
|
}
|
||||||
if (attrObj["name"] == "Total_Reads_GB") {
|
} else if (attrObj["id"] == 242) {
|
||||||
totalReads = QString::number(attrObj["raw"].toObject()["value"].toInt()) + " GB";
|
if (attrObj["name"] == "Total_Reads_GB") {
|
||||||
} else if (attrObj["name"] == "Host_Reads_32MiB") {
|
totalReads = QString::number(attrObj["raw"].toObject()["value"].toInt()) + " GB";
|
||||||
double gibibytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
} else if (attrObj["name"] == "Host_Reads_32MiB") {
|
||||||
totalReads = QString::number(static_cast<int>(gibibytes)) + " GB";
|
double gibibytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
||||||
} else if (attrObj["name"] == "Total_LBAs_Read") {
|
totalReads = QString::number(static_cast<int>(gibibytes)) + " GB";
|
||||||
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
} else if (attrObj["name"] == "Total_LBAs_Read") {
|
||||||
unsigned long long lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
||||||
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
unsigned long long lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
||||||
unsigned long long totalGbWriten = (lbaRead * logicalBlockSize) / oneGB;
|
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
||||||
totalReads = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
unsigned long long totalGbWriten = (lbaRead * logicalBlockSize) / oneGB;
|
||||||
}
|
totalReads = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
||||||
} else if (attrObj["id"] == 246 && !isNvme) { // MX500
|
}
|
||||||
if (attrObj["name"] == "Total_LBAs_Written") {
|
} else if (attrObj["id"] == 246) { // MX500
|
||||||
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
if (attrObj["name"] == "Total_LBAs_Written") {
|
||||||
unsigned long long lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
unsigned int logicalBlockSize = localObj["logical_block_size"].toInt();
|
||||||
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
unsigned long long lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
|
||||||
unsigned long long totalGbWriten = (lbaWritten * logicalBlockSize) / oneGB;
|
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
||||||
totalWrites = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
unsigned long long totalGbWriten = (lbaWritten * logicalBlockSize) / oneGB;
|
||||||
|
totalWrites = QString::number(static_cast<int>(totalGbWriten)) + " GB";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user