BUG: /usr/bin/uptime always reports 0/0/0 average
Roland Mainz
roland.mainz@nrubsig.org
Tue Aug 27 20:49:57 GMT 2024
On Tue, Aug 27, 2024 at 6:29 PM Eliot Moss via Cygwin <cygwin@cygwin.com> wrote:
> On 8/27/2024 11:31 AM, Jon Turney via Cygwin wrote:
> > 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
>
> Thank you for the explanation, Mark!
>
> I see that /proc/loadavg appears to get updated. If one wants the information,
> is that a more reliable source than calling uptime for load averages?
What about adding a new cygwin daemon, or add a loadavg-thread to cygserver ?
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
More information about the Cygwin
mailing list