Skip to content

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Dec 1, 2025

-- The network control not have logic name and address,
   so disable failed.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-334701.html
-- Adjust code logic to show gpu mem.

pick from: linuxdeepin@ee4e916

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-336355.html
-- Logic code error. Not find the id of mouse or keyboard to set awake.

pick from: linuxdeepin@98b67c8

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-336943.html
-- code logic error.
-- Not judge the speciall platform success.

pick from: linuxdeepin@29ffb3d

Log: fix issue
Bug:
-- Some special platform, GPU info not show.
-- Pre cache the GPU info.

pick from: linuxdeepin@beb3ba1

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-340131.html
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @add-uos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个代码diff进行详细分析:

  1. 代码逻辑改进:
  • 移除了getGpuInfoByCustom方法,改用更直接的getGpuInfoForFTDTM方法,简化了GPU信息获取流程
  • 将GPU内存信息的读取从外部命令执行改为直接读取系统文件"/sys/kernel/debug/gc/total_mem",更加可靠
  • 优化了特殊机型的判断逻辑,用isHwPlatform()替代了原来的specialComType > 0判断
  1. 代码性能优化:
  • 使用静态变量缓存GPU信息(gpuMemInfo),避免重复读取文件
  • 将DConfig的初始化移到main函数中,避免重复创建
  • GPU信息获取改为异步方式,提高响应速度
  1. 安全性改进:
  • 文件读取增加了错误检查,包括文件打开失败和内容为空的情况
  • 使用QRegularExpression进行安全的内存信息解析
  • 增加了对网卡禁用功能的判断,防止误操作
  1. 代码质量提升:
  • 添加了更多详细的日志输出
  • 使用更规范的命名约定(kGraphicsMemory)
  • 代码结构更清晰,功能划分更合理
  • 添加了适当的注释说明
  1. 具体建议:
  • GPU内存信息解析部分可以增加更多单位支持(TB等)
  • 可以考虑添加配置项来控制GPU信息缓存的有效期
  • 建议添加对异常情况(如文件权限问题)的更详细处理
  • 可以考虑将GPU信息获取的相关代码封装成单独的类
  1. 潜在风险:
  • 直接读取"/sys/kernel/debug/gc/total_mem"可能需要root权限,需要确保程序有足够权限
  • 静态变量缓存可能导致信息不能及时更新,需要考虑刷新机制
  • 正则表达式匹配可能不够严谨,建议增加边界检查

总体来说,这次改动提高了代码的可靠性和性能,但还需要注意一些边界情况和异常处理。建议在测试时特别关注权限问题和异常情况的处理。

@deepin-ci-robot
Copy link

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos
Copy link
Contributor Author

add-uos commented Dec 1, 2025

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Dec 1, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 37fd916 into linuxdeepin:master Dec 1, 2025
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants