load average calculation failing -- fixed by Windows update

Corinna Vinschen corinna-cygwin@cygwin.com
Fri May 13 11:05:37 GMT 2022


On May 13 13:04, Corinna Vinschen wrote:
> On May 13 11:34, Jon Turney wrote:
> > On 12/05/2022 10:48, Corinna Vinschen wrote:
> > > On May 11 16:40, Mark Geisert wrote:
> > > > 
> > > > The first counter read now gets error 0xC0000BC6 == PDH_INVALID_DATA, but no
> > > > errors on subsequent counter reads.  This sounds like it now matches what
> > > > Corinna reported for W11.  I wonder if she's running build 1706 already.
> > > 
> > > Erm... looks like I didn't read your mail throughly enough.
> > > 
> > > This behaviour, the first call returning with PDH_INVALID_DATA and only
> > > subsequent calls returning valid(?) values, is what breaks the
> > > getloadavg function and, consequentially, /proc/loadavg.  So maybe xload
> > > now works, but Cygwin is still broken.
> > 
> > The first attempt to read '% Processor Time' is expected to fail with
> > PDH_INVALID_DATA, since it doesn't have a value at a particular instant, but
> > one averaged over a period of time.
> > 
> > This is what the following comment is meant to record:
> > 
> > "Note that PDH will only return data for '% Processor Time' after the second
> > call to PdhCollectQueryData(), as it's computed over an interval, so the
> > first attempt to estimate load will fail and 0.0 will be returned."
> 
> But.
> 
> Every invocation of getloadavg() returns 0.  Even under load.  Calling
> `cat /proc/loadavg' is an excercise in futility.
> 
> The only way to make getloadavg() work is to call it in a loop from the
> same process with a 1 sec pause between invocations.  In that case, even
> a parallel `cat /proc/loadavg' shows the same load values.
> 
> However, as soon as I stop the looping process, the /proc/loadavg values
> are frozen in the last state they had when stopping that process.

Oh, and, stopping and restarting all Cygwin processes in the session will
reset the loadavg to 0.

> Any suggestions how to fix this?
> 
> 
> Corinna


More information about the Cygwin-developers mailing list