public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* Re: load average calculation failing
       [not found] ` <3a3edd10-2617-0919-4eb0-7ca965b48963@maxrnd.com>
@ 2022-05-08 10:27   ` Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2022-05-08 10:27 UTC (permalink / raw)
  To: Mark Geisert, Cygwin Patches

On 08/05/2022 08:01, Mark Geisert wrote:
> Mark Geisert wrote (on the main Cygwin mailing list):
>> I've recently noticed that the 'xload' I routinely run shows zero load 
>> even with compute-bound processes running.  This is on both Cygwin 
>> pre-3.4.0 as well as 3.3.4.  A test program, shown below, indicates 
>> that getloadavg() is returning with 0 status, i.e. not an error but no 
>> elems
>> of the passed-in array updated.
>>
>> Stepping with gdb through the test program seems weird within the 
>> loadavginfo::load_init method.  Single-stepping at line loadavg.cc:68 
>> goes to strace.h:52 and then to _sigbe ?!
>>
>> I had recently updated both Cygwin and Windows 10 to latest at the 
>> same time so I cannot say when the failure started.  Last day or two 
>> at most.
>>
[...]
> 
> I've debugged a bit further..  Within Cygwin's loadavg.cc:load_init(), 
> the PdhOpenQueryW() call returns successfully.  The subsequent 
> PdhAddEnglishCounterW() call is unsuccessful.  It returns status 
> 0x800007D0 == PDH_CSTATUS_NO_MACHINE. The code (at line 68 mentioned 
> above) calls debug_printf() to conditionally display the error, which is 
> what leads to the strace.h and _sigbe; that's fine.
> 
> The weird PDH_CSTATUS_NO_MACHINE is the problem.  I'll try running the 
> example from an elevated shell.  Or rebooting the machine.  After that 
> it's consulting some oracle TBD. :-(
> 

Thanks for looking into this.
You can find the user space version of this code I initially wrote at 
https://github.com/jon-turney/windows-loadavg, which might save you some 
time.

I can't reproduce this on W10 21H1, so I think this must be due to some 
change in later Windows...


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-08 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.BSF.4.63.2205051618470.42373@m0.truegem.net>
     [not found] ` <3a3edd10-2617-0919-4eb0-7ca965b48963@maxrnd.com>
2022-05-08 10:27   ` load average calculation failing Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).