-
-
Notifications
You must be signed in to change notification settings - Fork 456
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
GPUMeter code refactor & macOS support #1620
Open
Explorer09
wants to merge
8
commits into
htop-dev:main
Choose a base branch
from
Explorer09:gpu-meter-darwin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Signed-off-by: Kang-Che Sung <[email protected]>
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 <[email protected]>
This makes GPUMeter code portable, that is, allow other platforms to support GPU meter. Co-authored-by: Matteo Nicoli <[email protected]> Signed-off-by: Kang-Che Sung <[email protected]>
This slightly reduces code size. Signed-off-by: Kang-Che Sung <[email protected]>
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 <[email protected]> Signed-off-by: Kang-Che Sung <[email protected]>
The GPUMeter code is now platform independent. Co-authored-by: Matteo Nicoli <[email protected]> Signed-off-by: Kang-Che Sung <[email protected]>
Thank you @Explorer09. For what concerns the last commit, it's fine for me |
Co-authored-by: Kang-Che Sung <[email protected]>
@Explorer09 You can re-attribute commit authorship using
and add the appropriate HTH. |
a2b80a7
to
d185c13
Compare
@Explorer09 Does this PR (partially) superseed #1606 by @aestriplex? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Extension or improvement to existing feature
Linux 🐧
Linux related issues
MacOS 🍏
MacOS / Darwin related issues
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.)