Bug 269097 - rctl(8) seems to include idle time in cputime
Summary: rctl(8) seems to include idle time in cputime
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-22 15:51 UTC by dfr
Modified: 2023-01-22 15:51 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dfr 2023-01-22 15:51:18 UTC
I tried to use rctl_get_racct("jail:0", ...) to get metrics for the host but cputime seems to include time spent in the idle process. On an idle machine with 16 hardware threads, I ran this:

$ while true; do sudo rctl -u jail:0 | grep cputime; sleep 1; done
cputime=4145725
cputime=4145741
cputime=4145757
cputime=4145773
cputime=4145789

The cputime increases by 16 each time. I was expecting filter jail:0 to show summary cputime metrics for the host plus jails but instead, it always shows 100% cpu usage. If this is intentional, it should probably be mentioned in the documentation.

I can probably work around by getting metrics for the idle proc and subtracting.