From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m0.truegem.net (m0.truegem.net [69.55.228.47]) by sourceware.org (Postfix) with ESMTPS id B66F43858C53 for ; Sun, 8 May 2022 07:01:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B66F43858C53 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maxrnd.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=maxrnd.com Received: (from daemon@localhost) by m0.truegem.net (8.12.11/8.12.11) id 24871NBd062349 for ; Sun, 8 May 2022 00:01:23 -0700 (PDT) (envelope-from mark@maxrnd.com) Received: from 162-235-43-67.lightspeed.irvnca.sbcglobal.net(162.235.43.67), claiming to be "[192.168.1.100]" via SMTP by m0.truegem.net, id smtpdE4hCfH; Sun May 8 00:01:21 2022 Subject: Re: load average calculation failing From: Mark Geisert To: Cygwin-developers References: Message-ID: <3a3edd10-2617-0919-4eb0-7ca965b48963@maxrnd.com> Date: Sun, 8 May 2022 00:01:22 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Sun, 08 May 2022 07:01:27 -0000 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. > > ..mark > > ------------------- > #define _GNU_SOURCE > #include > #include > > int > main (int argc, char **argv) > { >     double loadavg[3]; > >     int res = getloadavg (loadavg, 3); >     if (res == -1) >         return 0xFF; >     if (res > 0) >         for (int i = 0; i < res; i++) >             printf ("%f.2 ", loadavg[i]); > >     return res; > } 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. :-( ..mark