GPUMeter code refactor & macOS support#1620
Merged
BenBE merged 8 commits intohtop-dev:mainfrom May 9, 2025
Merged
Conversation
Contributor
|
Thank you @Explorer09. For what concerns the last commit, it's fine for me |
Member
|
@Explorer09 You can re-attribute commit authorship using and add the appropriate HTH. |
a2b80a7 to
d185c13
Compare
Member
|
@Explorer09 Does this PR (partially) superseed #1606 by @aestriplex? |
Contributor
Author
5bfc4e2 to
8658531
Compare
8658531 to
5946967
Compare
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
GPUMeter_updateValues() used a locally cached "residue time" variable for computing the percentage of the "GPU residue" usage. The "residue" percentages of subsequent GPUMeter instances could be 0 due to the cached "residue time" off-sync with the time data from the LinuxMachine instance. Rewrite the logic of the function so that all computed GPU percentage values are cached, and the cache updated only when there's increment on host->monotonicMs. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This makes GPUMeter code portable, that is, allow other platforms to support GPU meter. Co-authored-by: Matteo Nicoli <matteo.nicoli001@gmail.com> Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This slightly reduces code size. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
GPUMeter now allows placeholder values for GPU usage and "time differences". For platforms that do not support GPU, the GPU usage percentage may display as "N/A", and for platforms that cannot retrieve precise GPU time, the "GPU time differences" may be hidden from text mode display. Co-authored-by: Matteo Nicoli <matteo.nicoli001@gmail.com> Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
The GPUMeter code is now platform independent. Co-authored-by: Matteo Nicoli <matteo.nicoli001@gmail.com> Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
5946967 to
e58baca
Compare
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.
This is my attempt of refactoring the GPU meter code in order to support multiple platforms.
This branch includes #1618 which fixes a bug I discovered during the refactor process.
I adapted @aestriplex 's code in #1606 in the last commit of this branch. Yes I made the meter working in both bar and graph modes. (I don't want to take full credit for the last commit. If permitted, I wish to change the last commit so that @aestriplex is listed as the main author and I as a co-author.)