Fix: [GPU] Not show gpu on some platform.#529
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom Sep 3, 2025
Merged
Fix: [GPU] Not show gpu on some platform.#529deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
Conversation
-- Not show gpu on some platform. Log: fix issue Bug: https://pms.uniontech.com/task-view-378987.html
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR refactors the main function’s GPU info retrieval logic by separating the base and memory info calls so that GPU details are displayed even when memory info detection fails on some platforms. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
fa702c1 to
e96c146
Compare
deepin pr auto review我对这段代码进行审查,发现了一些需要改进的地方:
改进建议: #include <iostream>
#include <QMap>
#include <QString>
// 添加日志函数
void logInfo(const QString& message) {
std::cout << "[INFO] " << message.toStdString() << std::endl;
}
void logError(const QString& message) {
std::cerr << "[ERROR] " << message.toStdString() << std::endl;
}
bool getGpuBaseInfo(QMap<QString, QString> &mapInfo) {
// 原有实现
}
bool getGpuMemInfoForFTDTM(QMap<QString, QString> &mapInfo) {
// 原有实现
}
int main(int argc, char *argv[]) {
// 处理命令行参数
if (argc > 1) {
logError("Usage: " + QString(argv[0]) + " [no arguments]");
return 1;
}
QMap<QString, QString> mapInfo;
// 获取基础信息
if (!getGpuBaseInfo(mapInfo)) {
logError("Failed to get GPU base information");
return 1;
}
// 获取内存信息
if (!getGpuMemInfoForFTDTM(mapInfo)) {
logError("Failed to get GPU memory information");
return 1;
}
// 输出信息
for (auto it = mapInfo.begin(); it != mapInfo.end(); ++it) {
logInfo(it.key() + ": " + it.value());
}
return 0;
}
这些改进将使代码更加健壮、可维护,并提高其安全性。 |
max-lvs
approved these changes
Sep 3, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, max-lvs 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 |
Contributor
Author
|
/merge |
Contributor
|
This pr cannot be merged! (status: unstable) |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
7e87464
into
linuxdeepin:develop/eagle
15 of 17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-- Not show gpu on some platform.
Log: fix issue
Bug: https://pms.uniontech.com/task-view-378987.html
Summary by Sourcery
Bug Fixes: