Skip to content

Show CPU/memory usage in Qube manager again#424

Draft
alimirjamali wants to merge 1 commit intoQubesOS:mainfrom
alimirjamali:issue-7817-cpu-mem-usage
Draft

Show CPU/memory usage in Qube manager again#424
alimirjamali wants to merge 1 commit intoQubesOS:mainfrom
alimirjamali:issue-7817-cpu-mem-usage

Conversation

@alimirjamali
Copy link
Copy Markdown
Contributor

@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.19%. Comparing base (8dd162e) to head (4301eb1).
⚠️ Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
qubesmanager/qube_manager.py 89.74% 4 Missing ⚠️
qubesmanager/utils.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
+ Coverage   69.05%   69.19%   +0.13%     
==========================================
  Files          17       17              
  Lines        3855     3895      +40     
==========================================
+ Hits         2662     2695      +33     
- Misses       1193     1200       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alimirjamali alimirjamali force-pushed the issue-7817-cpu-mem-usage branch from d330493 to 4301eb1 Compare May 4, 2025 11:43
@alimirjamali alimirjamali marked this pull request as ready for review May 4, 2025 12:19
Copy link
Copy Markdown
Member

@marmarta marmarta left a comment

Choose a reason for hiding this comment

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

I played around with this PR for a bit, and while I generally love it, I have comments:

  • sorting: I think that sorting on usage is kinda problematic right now; it keeps dom0 as top item, which is a bit counterintuitive but consistent with the rest of the code, but also on ascending sorting puts all the non-running VMs on top and the running ones on bottom, which is definitely unintuitive, and on descending sorting puts dom0 at the very end, even though it is definitely running. I think any sorting on usage should put VMs that are consuming resources on top, disregarding special dom0 status too.
  • I get different numbers on CPU usage in qube manager and in domains widget, which is not great; there seems to be different rounding, because the error is off-by-one sometimes, but I think they need to be consistent

@alimirjamali
Copy link
Copy Markdown
Contributor Author

I played around with this PR for a bit, and while I generally love it, I have comments:

* sorting: I think that sorting on usage is kinda problematic right now; it keeps dom0 as top item, which is a bit counterintuitive but consistent with the rest of the code, but also on ascending sorting puts all the non-running VMs on top and the running ones on bottom, which is definitely unintuitive, and on descending sorting puts dom0 at the very end, even though it is definitely running. I think any sorting on usage should put VMs that are consuming resources on top, disregarding special dom0 status too.

* I get different numbers on CPU usage in qube manager and in domains widget, which is not great; there seems to be different rounding, because the error is off-by-one sometimes, but I think they need to be consistent

The suggested changes will be applied. I changed the PR status to draft while I work on it and until I finish it.

@alimirjamali alimirjamali marked this pull request as draft May 25, 2025 10:34
@Sahilll10
Copy link
Copy Markdown

Hi @alimirjamali @marmarta
I am working on the System Health Monitor project for GSoC 2026, and in order to do some groundwork before the Pre-GSOC period, I wanted to ask if I can pick up the sorting fix that marmarta flagged.

After thoroughly going through the files and code, the sorting for CPU and MEM columns currently returns int(vm.CPU_usage) directly.

The problem is:
Non-running VMs return None for CPU_usage so they end up sorted incorrectly above running VMs in ascending order
dom0 has no special handling so it falls to the bottom in descending order

The fix I am thinking of — 1) for CPU and MEM sort values, return -1 for non-running VMs so they always sort below running ones, and keep dom0 pinned at the top the same way it is handled in the existing UserRole + 1 sort logic.
2) For the rounding difference between qube_manager and domains widget — domains widget uses int(cpu_usage) directly from vm-stats.
The PR rounds the same way so I need to check where the off-by-one comes from.

Would it be okay if I open a PR with this fix building on your work? I will be testing it using MockQubesComplete.

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.

Show CPU/memory usage in Qube manager again

3 participants