Skip to content
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
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Explorer09
Copy link
Contributor

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

Explorer09 and others added 7 commits February 24, 2025 02:13
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]>
@aestriplex
Copy link
Contributor

Thank you @Explorer09. For what concerns the last commit, it's fine for me

Co-authored-by: Kang-Che Sung <[email protected]>
@BenBE
Copy link
Member

BenBE commented Feb 24, 2025

@Explorer09 You can re-attribute commit authorship using

git commit --author=aestriplex --amend

and add the appropriate Co-authored-by: attribution lines at the end of the commit message.

HTH.

@BenBE BenBE added enhancement Extension or improvement to existing feature Linux 🐧 Linux related issues MacOS 🍏 MacOS / Darwin related issues labels Feb 24, 2025
@BenBE BenBE added this to the 3.4.1 milestone Feb 24, 2025
@BenBE
Copy link
Member

BenBE commented Feb 24, 2025

@Explorer09 Does this PR (partially) superseed #1606 by @aestriplex?

@Explorer09
Copy link
Contributor Author

Explorer09 commented Feb 24, 2025

@BenBE Yes, this supersedes #1606 entirely. But this won't close the #1597 issue as this only implements half of the feature (no GPU time in process table yet).

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants