fix(gpu): fix GPU VRAM size parsing failure on multi-line gpu-info - #719
fix(gpu): fix GPU VRAM size parsing failure on multi-line gpu-info#719add-uos wants to merge 1 commit into
Conversation
Split gpu-info by single "\n" and parse each line separately instead of splitting the whole content by "\n\n" and ":" on the entire string. 修复多行gpu-info文件显存大小解析失败的问题,改为逐行分割解析。 Log: 修复显存大小解析失败问题 PMS: BUG-372403 Influence: 修复后含多行的gpu-info文件能正确解析显存大小并显示。
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts GPU VRAM size parsing logic to correctly handle multi-line gpu-info files and updates the SPDX copyright year range. Flow diagram for updated gpu-info VRAM parsing logicgraph TD
A[DeviceGpu::setHwinfoInfo] --> B[QFile::open QIODevice::ReadOnly]
B --> C[QFile::readAll]
C --> D[QString::split '\n']
D --> E[iterate each item]
E --> F{item.isEmpty}
F -- yes --> E
F -- no --> G[QString::split ':' QT_SKIP_EMPTY_PARTS]
G --> H{tmpItems.size == 2}
H -- no --> E
H -- yes --> I[parse VRAM size from tmpItems]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已修复核心问题,无需进一步修改。以下为完整上下文展示:
if (file.open(QIODevice::ReadOnly)) {
qCDebug(appLog) << "gpu-info file opened successfully.";
QString allStr(file.readAll());
QStringList items = allStr.split("\n");
file.close();
foreach (const QString &item, items) {
if (item.isEmpty()) {
continue;
}
QStringList tmpItems = item.split(":", QT_SKIP_EMPTY_PARTS);
if (tmpItems.size() != 2) {
continue;
}
// 后续处理逻辑...
}
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Split gpu-info by single "\n" and parse each line separately instead of splitting the whole content by "\n\n" and ":" on the entire string.
修复多行gpu-info文件显存大小解析失败的问题,改为逐行分割解析。
Log: 修复显存大小解析失败问题
PMS: BUG-372403
Influence: 修复后含多行的gpu-info文件能正确解析显存大小并显示。
Summary by Sourcery
Fix GPU VRAM size parsing from multi-line gpu-info files by parsing each line separately.
Bug Fixes:
Enhancements: