From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by sourceware.org (Postfix) with ESMTPS id 0D7663857349 for ; Fri, 13 May 2022 11:05:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0D7663857349 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MeD1l-1oNQgf28Up-00bH9Y for ; Fri, 13 May 2022 13:05:38 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id F1335A808A0; Fri, 13 May 2022 13:05:37 +0200 (CEST) Date: Fri, 13 May 2022 13:05:37 +0200 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: load average calculation failing -- fixed by Windows update Message-ID: Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <3a3edd10-2617-0919-4eb0-7ca965b48963@maxrnd.com> <223aa826-7bf9-281a-aed8-e16349de5b96@dronecode.org.uk> <53664601-5858-ffd5-f854-a5c10fc25613@maxrnd.com> <670cea06-e202-3c90-e567-b78d737f5156@dronecode.org.uk> <2c7d326d-3de0-9787-897f-54c62bf3bbcc@maxrnd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:6rV9UAMTr8IrGlga355c6CUBRl3gpGq7B5tG+MR85+6penJkiiB EIhwFzI8w/TDFkFarYwIOV4xS6N6jpuC62tKcn/3Hfks+x66w2kSzTXqZu0Wat9QUUF9wxM Bre6ts09RiDEfASgJYYQFUo0OBjcBEX9DFw8Fj5trXg21nE5LZLIR0dAjyU7+UHr16hnjYF gcLaoEbCPdCv3gXz3KLEA== X-UI-Out-Filterresults: notjunk:1;V03:K0:PHin7EqC/jI=:yAggNW6SbIFxB0nY+G8d9R PI9xPYeRAc6GjKWk6EpsZRMSQ0toqJHUW33n2dfW7OsgYZxGLoxUurWn7Q5Uu0u3r0P8io9b+ vgFmHCFTdnSReMrQYp4uAW77bq7hbMBNWjT77+Qw7TcUpunzSrpHJtbRMY7yVsjbzKAhc4lHH eerjFvjmQZic5j3P4zDAFpLisP1zkx2GE/1aY26IjkS2/54YNPh20o0EtxM/1eFmCMJVHLMMf N2eKao078YAFfCKPef4GccBv/YJtYo0rWP9W7Qxt5esxt13rNA1JMMWrrBvBLvf+cakCkcmFk bzDkGiCf/lPOiuFmdd0PSRmjik1fI1ICRrW3HiZBBPeZgjqBSTcb9VBObLpCpZjASdeDeVK/0 kClqogeOEb2byLT02XOPIYwQPX9uXr/t4IhIA/9yayKMWFcy9veaMTV5vpFm3jA/VtcE6CS8Y N/orlm2rx4RuIRDe0hxdhva7/3amciUKfpYPOuhf6t+JhpfmeYm9+WPjgCqmmVtmFy/0gc97c 3zUaZO427SULP0Sk5RsXtaDb8W5NZc9+qJneJIfangBc1yhK9jMJmhb6KhUJMEoGbfn0W67w5 8XFrha0VH7bqdDM+zlYGfe49otoTwoENY/gDIpapQbDK2/sIrJeQpnuZ5GP4d+YMVG7p+jotl jjrnK7nrNYDJGsBcTiBBcznCNnoRsVMQ/0Cc5GF4Lbr1zr2puMVq6YS/434T9L6CCgKFfVef5 L7lboXcmLANPpn1K X-Spam-Status: No, score=-95.3 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_FAIL, SPF_HELO_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 11:05:41 -0000 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