Bug 269097

Summary: rctl(8) seems to include idle time in cputime
Product: Base System Reporter: dfr
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me    
Priority: ---    
Version: 13.1-RELEASE   
Hardware: Any   
OS: Any   

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.