BUG: /usr/bin/uptime always reports 0/0/0 average
Jon Turney
jon.turney@dronecode.org.uk
Tue Aug 27 15:31:39 GMT 2024
On 27/08/2024 09:21, Mark Liam Brown via Cygwin wrote:
> Greetings!
>
> /usr/bin/uptime always reports 0/0/0 average cpu load:
> $ uptime
> 10:09:01 up 15:59, 0 user, load average: 0.00, 0.00, 0.00
>
> is this a known bug?
Kind of.
Due to windows API limitations, the current implementation has the
short-coming that a process's first call to getloadavg() does not update
the globally-maintained loadavg data.
(Because the Windows API cannot provide instantaneous cpu load, only
over the period between two calls)
(So e.g. if you run something like top in another terminal, you'll
suddenly see uptime return more sensible values)
See the discussion [1] for more context, and discussion of various
approaches to fixing this, which petered out without a patch to [2]...
[1] https://cygwin.com/pipermail/cygwin-developers/2022-May/012569.html
[2] https://cygwin.com/cgit/newlib-cygwin/tree/winsup/cygwin/loadavg.cc
More information about the Cygwin
mailing list