On Tue, 27 Aug 2024 at 18:30, 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?
I get this on a stressed system with HUNDREDS of running processes: $ cat /proc/loadavg 0.00 0.00 0.00 1/21 The problem is that this breaks parallel builds (e.g. GNU make, dmake, ...), which all rely on getloadavg() to cap/limit starting new processes until the load goes below a certain threshold. Returning just 0.0/0.0/0.0 is basically the IT equivalent for the nuclear option: Launch more and more processes, check getloadavg(), which returns "system is idle", which causes more and more processes being started, until the machine grinds to a halt for interactive users. That is... pretty bad. Ced -- Cedric Blancher <cedric.blanc...@gmail.com> [https://plus.google.com/u/0/+CedricBlancher/] Institute Pasteur -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple