[lxc-users] "ps auxf" always showing 0.0% for CPU usage in LXD container?

Simos Xenitellis simos.lists at googlemail.com
Wed Mar 28 14:29:16 UTC 2018


On Wed, Mar 21, 2018 at 7:03 PM, Tomasz Chmielewski <mangoo at wpkg.org> wrote:
> Let's run this in a LXD container:
>
> container# cat /dev/urandom|gzip - >/dev/null
>
>
> Then see what CPU usage "ps auxf" shows (3rd column):
>
> container# ps auxf
> USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
> root     18177  0.0  0.0   4632  1584 pts/0    R+   16:47  11:33  |       \_
> gzip -
> (...)
>
> Then, the same in the host:
>
> host# ps auxf
> USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
> 100000   14878 99.7  0.0   4632  1584 pts/0    R+   16:47  11:47      |   |
> \_ gzip -
> (...)
>
> Why does the container show it incorrectly as 0.0?
>

If you try with 'top' in the container, it shows correctly the %CPU to be 100%.
I think the 'ps' always shows 0.0 for %CPU in any process when run in
the container.
It could be related to LXCFS. I run LXD 3.0 beta, thus the same is
happening with LXCFS 3 (beta).

Simos


More information about the lxc-users mailing list