Repository navigation
feat(metrics): report VMM thread CPU usage - #6264
Richard-Durkee wants to merge 1 commit into
Conversation
cff330e to
9c64355
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Please upload reports for the commit 731f435 to get more accurate results. Additional details and impacted files@@ Coverage Diff @@
## main #6264 +/- ##
==========================================
- Coverage 83.59% 83.35% -0.24%
==========================================
Files 282 278 -4
Lines 33585 31980 -1605
==========================================
- Hits 28074 26656 -1418
+ Misses 5511 5324 -187
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9c64355 to
f998e10
Compare
| /// Metric for signaling a panic has occurred. | ||
| pub panic_count: SharedStoreMetric, | ||
| /// CPU time the VMM thread used since the last metrics flush, in microseconds. | ||
| pub thread_cpu_us: SharedIncMetric, |
There was a problem hiding this comment.
Can we name it "main_thread_cpu_us" for clarity? Similar for the other variables and function names (last_main_thread_cpu_us, update_main_thread_cpu_usage).
| /// The metrics are flushed from the event loop, so the calling thread is the VMM thread. | ||
| fn update_thread_cpu_usage(&mut self) { | ||
| let thread_cpu_us = get_time_us(ClockType::ThreadCpu); | ||
| METRICS |
There was a problem hiding this comment.
Instead of adding to it every time, can't we just set it to get_time_us(ClockType::ThreadCpu) directly?
The main thread runs the event loop and emulates every device that has no worker thread of its own, but no metric shows how busy it is, so a saturated main thread can only be spotted with host tools. Add vmm.main_thread_cpu_us, the CPU time the main thread has used, read from CLOCK_THREAD_CPUTIME_ID each time the metrics are written. The seccomp filters already allow clock_gettime. Signed-off-by: Richard Durkee <56232628+Richard-Durkee@users.noreply.github.com>
f998e10 to
731f435
Compare
Changes
Add
vmm.thread_cpu_us: the CPU time the VMM thread used since the last metrics flush. It is read withclock_gettime(CLOCK_THREAD_CPUTIME_ID)when the metrics are written.Reason
All device emulation runs on the VMM thread, but no metric shows how busy that thread is.
thread_cpu_us / flush intervalgives its utilization, so a saturated VMM thread can be spotted without host tools liketop -H.License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyle --no-clippyto verify that the PRpasses the automated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.