-
Notifications
You must be signed in to change notification settings - Fork 40
Perf: Improve program performance #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
GongHeng2017
wants to merge
69
commits into
linuxdeepin:master
from
GongHeng2017:202508051452-eagle-fix
Closed
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
b354698
chore: uniform some arm model code
c08fc94
chore: extend toml
1c81683
fix: [network] add network full support
e3c87c6
chore: [translate] support lupdate auto
400b158
chore: extend flmx mode of device
add-uos 4d4e3f7
fix: the flmx device of monitor display
add-uos 958f62c
fix: the pgux device of monitor display
add-uos ed96373
fix: get the network of usb vender info
add-uos da8e009
fix: [network] add communication network support
093ad2a
fix: [network] add communication network support
d6a9c9f
fix: the w515 device of monitor display
add-uos 02ee8d0
fix: the w525 device of monitor display
add-uos db15a61
fix: fix the UFS display
add-uos 7602f7e
fix: remove invalid url
wyu71 4820581
fix: the camera info show incorrect
add-uos 366a729
fix: the bluetooth of false identification
add-uos 02f7a69
fix: the device of monitor display
add-uos 49ecd82
fix: the monitor fresh rate
add-uos 3225848
fix: the monitor paramer
add-uos 4cce766
fix: the storage siez display
add-uos 8702ea6
fix: the monitor get info from xrander
add-uos a9acd86
fix: adjust the select usb timeout
add-uos a7454bd
fix: fit the UFS for klv
add-uos 3c7ae8d
Revert "fix: adjust the select usb timeout"
GongHeng2017 7933df4
fix: adjust the select usb timeout
GongHeng2017 05b1de7
feat: add the storage overview info
add-uos c6948df
feat: modify the storage size
add-uos 4b2ff1c
fix: the get info from edit in order
add-uos ed89899
fix: the monitor info in single screen mode (#436)
add-uos 899d8b4
fix: get the storage size info from smartctl (#450)
add-uos 9a46594
fix: the monitor display info in special machine (#453)
add-uos 2e1f8ea
fix: the audio device registe two pci device can't be disable
add-uos 12eaa7c
fix: the audio device may cause crush
add-uos 8e794c9
fix: fit multiple audio device enable function
add-uos cf8924c
fix: modify the mouse device name
add-uos 480a9ef
fix the USB audio device can't be disable
add-uos da94bed
fix: filter the invalid power device (#461)
add-uos 1977ed4
fix: the invalded device show incorrect (#462)
add-uos 0d1d1c7
Fix: the monitor device incorrect order (#463)
GongHeng2017 07bb6c9
fix: modify the temperature of battery.
add-uos 73f65c2
fix: the cpu model in special machine.
add-uos e675774
fix: remove useless info.
add-uos af46605
fix: adjust the storage display order.
add-uos 8777b22
fix: update device description to Universal Flash Storage
add-uos d6eac66
fix: add the detail mode of screen size
add-uos e85b470
fix: [network] The wireless maybe connect.
GongHeng2017 1ba0d2a
fix: fix wakeup ps/2 mouse
add-uos 7f7dc01
fix: format the overview of memory display
add-uos c788e3c
fix: [GPU] The max resolution and min resolution show error.
GongHeng2017 a9de646
feat: Update display size for specific device models
add-uos 2941cca
fix: [Stroage-interface] The interface show error. (#487)
GongHeng2017 2608aae
fix: Format graphics card resolution display
add-uos 350c0a6
feat: [GPU] Add logic to show GPU info.
GongHeng2017 19f6a31
feat: [GPU] Add extra information display logic.
GongHeng2017 496262e
fix: Improve supported resolution detection for display devices
add-uos b71dbea
fix: maintain the monitor info in special machine.
add-uos d705a5e
feat: [GPU] Add logic to show GPU info.
GongHeng2017 b95f55c
feat: [GPU] Add feature for GPU.
GongHeng2017 553f3a9
feat: [GPU] Add logic to show GPU info.
GongHeng2017 10e0f89
Chore: [cppcheck] Resolve issue identified by cppcheck
GongHeng2017 52f6971
Perf: [cppcheck] parameter should be passed by const reference.
GongHeng2017 6e5ecd7
fix: Update input device Bus interface display
add-uos 662a912
Feat: [Monitor] The monitor name show error.
GongHeng2017 dabc018
fix: [cppcheck] Remove the useless code.
GongHeng2017 04d5c66
Perf: [cppcheck] Improve program execution efficiency.
GongHeng2017 6961768
fix: [Net-Wakeup] The net card can not wakeup.
GongHeng2017 bcee01b
Perf: Improve program performance
GongHeng2017 5e5dff5
Perf: Improve program performance
GongHeng2017 f965949
Chore: Fix the cppcheck warning.
GongHeng2017 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| cmake_minimum_required(VERSION 3.7) | ||
|
|
||
| set(BIN_NAME "customgpuinfo") | ||
|
|
||
| find_package(Qt5 COMPONENTS Core REQUIRED) | ||
|
|
||
| file(GLOB_RECURSE SRC | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/*.h" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" | ||
| ) | ||
|
|
||
| add_executable(${BIN_NAME} | ||
| ${SRC} | ||
| ) | ||
|
|
||
| target_include_directories(${BIN_NAME} PUBLIC | ||
| Qt5::Core | ||
| ) | ||
|
|
||
| target_link_libraries(${BIN_NAME} PRIVATE | ||
| Qt5::Core | ||
| ) | ||
|
|
||
| install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/deepin-devicemanager) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| // SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. | ||
| // | ||
| // SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
| #include <QProcess> | ||
| #include <QMap> | ||
| #include <QRegularExpression> | ||
| #include <QFile> | ||
| #include <QDebug> | ||
|
|
||
| #include <iostream> | ||
|
|
||
| // 名称("Name") 厂商("Vendor") 型号("Model") 版本(Version) 显存("Graphics Memory") | ||
|
|
||
| constexpr char kName[] { "Name" }; | ||
| constexpr char kVendor[] { "Vendor" }; | ||
| constexpr char kModel[] { "Model" }; | ||
| constexpr char kVersion[] { "Version" }; | ||
| constexpr char kGraphicsMemory[] { "Graphics Memory" }; | ||
|
|
||
| bool getGpuBaseInfo(QMap<QString, QString> &mapInfo) | ||
| { | ||
| QProcess process; | ||
| QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | ||
| process.setProcessEnvironment(env); | ||
| process.start("/usr/bin/glxinfo", QStringList() << "-B"); | ||
| if (!process.waitForFinished(3000)) { | ||
| qCritical() << "Error executing glxinfo:" << process.errorString(); | ||
| return false; | ||
| } | ||
|
|
||
| QString output = QString::fromLocal8Bit(process.readAllStandardOutput()); | ||
| QStringList lines = output.split('\n'); | ||
| QRegularExpression regex("^([^:]+):\\s*(.+)$"); | ||
| for (const QString &line : lines) { | ||
| QRegularExpressionMatch match = regex.match(line); | ||
| if (match.hasMatch()) { | ||
| QString key = match.captured(1).trimmed(); | ||
| QString value = match.captured(2).trimmed(); | ||
| if (key == "OpenGL renderer string") { | ||
| mapInfo.insert(kName, value); | ||
| mapInfo.insert(kModel, value); | ||
| } else if (key == "OpenGL vendor string") { | ||
| mapInfo.insert(kVendor, value); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| bool getGpuMemInfoForFTDTM(QMap<QString, QString> &mapInfo) | ||
| { | ||
| const QString filePath = "/sys/kernel/debug/gc/meminfo"; | ||
| QString totalValue; | ||
| bool foundTotal = false; | ||
|
|
||
| QFile file(filePath); | ||
| if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
| qCritical() << "Error opening /sys/kernel/debug/gc/meminfo:" << file.errorString(); | ||
| return false; | ||
| } | ||
|
|
||
| QString content = QString::fromUtf8(file.readAll()); | ||
| file.close(); | ||
|
|
||
| if (content.isEmpty()) { | ||
| qCritical() << "Error: /sys/kernel/debug/gc/meminfo File is empty!"; | ||
| return false; | ||
| } | ||
|
|
||
| QRegularExpression system0Regex(R"(POOL SYSTEM0:*(.*?)POOL VIRTUAL:)", | ||
| QRegularExpression::DotMatchesEverythingOption); | ||
| QRegularExpressionMatch system0Match = system0Regex.match(content); | ||
|
|
||
| if (!system0Match.hasMatch()) { | ||
| qCritical() << "Error: Failed to find SYSTEM0 section"; | ||
| return false; | ||
| } | ||
|
|
||
| QString system0Content = system0Match.captured(1); | ||
| QRegularExpression totalRegex(R"(Total\s*:\s*(\d+)\s+B)"); | ||
| QRegularExpressionMatch totalMatch = totalRegex.match(system0Content); | ||
| if (totalMatch.hasMatch()) { | ||
| totalValue = totalMatch.captured(1); | ||
| foundTotal = true; | ||
| } | ||
|
|
||
| if (!foundTotal || totalValue.isEmpty()) { | ||
| qCritical() << "Error: Failed to find Total value in SYSTEM0 content"; | ||
| return false; | ||
| } | ||
|
|
||
| bool ok; | ||
| quint64 memSize = totalValue.trimmed().toULong(&ok, 10); | ||
| if (ok && memSize >= 1048576) { | ||
| memSize /= 1048576; | ||
| auto curSize = memSize / 1024.0; | ||
| if (curSize >= 1) { | ||
| totalValue = QString::number(curSize) + "GB"; | ||
| } else { | ||
| totalValue = QString::number(memSize) + "MB"; | ||
| } | ||
| } | ||
|
|
||
| mapInfo.insert(kGraphicsMemory, totalValue); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| QMap<QString, QString> mapInfo; | ||
| if (getGpuBaseInfo(mapInfo) && getGpuMemInfoForFTDTM(mapInfo)) { | ||
| for (auto it = mapInfo.begin(); it != mapInfo.end(); ++it) | ||
| std::cout << it.key().toStdString() << ": " << it.value().toStdString() << std::endl; | ||
| return 0; | ||
| } else { | ||
| return 1; | ||
| } | ||
| } | ||
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (bug_risk): Always overwriting sPath with path may break fallback logic.
This change removes the fallback to the database value, which may cause issues if the fallback is required for some hardware.