DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 47RGUvrS2222330
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=nVtyg9Fa
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D233385F032
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1724776255;
	bh=J3MH0aM3R1W2L5C1klUXz9xHNSibxeoTYHVkFJzxfZs=;
	h=Date:Subject:To:Cc:References:In-Reply-To:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=nVtyg9FaJushV9zqvQYnXFUIlnB9p7qY+SADx0A9Ypv4AsIHGY6zWgA7mdXT2brOB
	 z+BwCkUNzeQqGtGETF2eMJiCxlk7XIQ57wMBjWJ+tchxJL1o5ThdwilTYkOu1BAZzj
	 o1o3mCteYR5Vyq4jmiXAR1MHv5qWBD/dL8yLNf5c=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EA863858283
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4EA863858283
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724776199; cv=none;
 b=pjepYuenx2EmeFgogDBY7WZVEzsR8dPuEc0zK9BeVGflossP2qvNHY6jEwQgVE+3IRFX724xuorFg+ub4k6tDMzUFTganGuSmhbkqr2FjzvgAWZW33hcCCI0Kcvfq30zD8YguzYc+ZxrNmcjWBIzy/x0Am0ZHINIk68Cm3eZVNI=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1724776199; c=relaxed/simple;
 bh=VSl9RR+WDVdP6Ck85HsCyzgu4tbwGtDTaKjotbqPmDc=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
 b=Jsg5+4G2cbtACo4umljOOiV6rIpkfHL41HcQuv5LNpSCvXMiLlmZ/QrRFghrYlZs1aboSNOjleaZSiXkRI2Sr6e2e4cfgXne0vm3wEIA9lStASMuWrNAU8QjUGh7BuA2o4NrYablJHDQDPqj8qSANElIMZbODcdRAIBqy15sRpA=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-ASG-Debug-ID: 1724776197-24039d16a3d58e50001-w5GHUG
X-Barracuda-Envelope-From: moss@cs.umass.edu
X-Barracuda-RBL-Trusted-Forwarder: 128.119.240.136
DKIM-Filter: OpenDKIM Filter v2.11.0 mailsrv.cs.umass.edu F05735BDC8
X-Barracuda-RBL-Trusted-Forwarder: 172.26.64.86
Message-ID: <2225cf8a-cb8a-6437-177d-9a83f7dec53c@cs.umass.edu>
Date: Tue, 27 Aug 2024 12:29:57 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.1
Subject: Re: BUG: /usr/bin/uptime always reports 0/0/0 average
Content-Language: en-US
X-ASG-Orig-Subj: Re: BUG: /usr/bin/uptime always reports 0/0/0 average
To: Jon Turney <jon.turney@dronecode.org.uk>,
        Mark Liam Brown <brownmarkliam@gmail.com>
Cc: cygwin@cygwin.com
References: <CAN0SSYxv9A8V6gGppEid0LnjHJtY4isDUFY-ey=nbM9PaDo_8g@mail.gmail.com>
 <be924247-c927-4fd7-8673-3cab4172aae7@dronecode.org.uk>
In-Reply-To: <be924247-c927-4fd7-8673-3cab4172aae7@dronecode.org.uk>
X-Barracuda-Connect: mailsrv.cs.umass.edu[128.119.240.136]
X-Barracuda-Start-Time: 1724776197
X-Barracuda-Encrypted: TLS_AES_256_GCM_SHA384
X-Barracuda-URL: https://barramail.cs.umass.edu:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at cs.umass.edu
X-Barracuda-Scan-Msg-Size: 1254
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0
 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.7 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.129632
 Rule breakdown below
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, JMQ_SPF_NEUTRAL, NICE_REPLY_A, SPF_HELO_NONE,
 SPF_PASS, 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@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Eliot Moss via Cygwin <cygwin@cygwin.com>
Reply-To: Eliot Moss <moss@cs.umass.edu>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 47RGUvrS2222330

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?

Best - Eliot


-- 
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

