DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 50JGdndU1791064 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 50JGdndU1791064 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=V6eZYarn X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 841FA3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1737304787; bh=IolMk8oMkqYOsYeDVIBsDHFTyL0j9CVLUVad3rsPMmg=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=V6eZYarnuSEEv+HAOJ3l4XPlsfee47Zc8g4jX9qJRQVStFGiwroHani3TPHAP73XK cwz9Hy/fUF8ox3P2zcJiDPEHSltA8VOoVh7JX3KcOR5M3IVPzzIn9jYeM/+ZiTDo0q 2QImGrbJdfY03MrQVGuSxBFTV5Gcauo2KS9dWOzM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D30E23858C50 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D30E23858C50 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737304724; cv=none; b=Sbw/V4nPUW8sPIx7pyZFO46/GQHgicdRuM5KnHaLAKRrSglVtPTzjwhXfc9CsDLHdTQ054ukbwmaqByWwVPfRtEFgRj7iOW/ZaB2WFEiO5c1Ay88E3LFas3z4j1//QNhvGYrekC5iT6Cle7jgX7j+zyUZZb2degf4tXomrRmKCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737304724; c=relaxed/simple; bh=ZK2Ac4nQ4skxiIvfmNEY+N65yWtkvmWVOQhooFY4VPY=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=jJ/XatUABErKNu5LZNK8m1UnO/LREZ/TVGqrhcIjKTb4a7NdkJbAqgTfA/kq9GETMbaGmqgPYXNqAhozDMsqpyOarYI3RLy0K8znDzBMNdhYDeHuNBECeUEECpLt3nESV5ivMXEhl+YsxEh2Oh+fnSEIenpAMOVXaSyXg/i0Sjc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D30E23858C50 Message-ID: <388acd4c-0ea6-4662-ae2e-e96b7ec2f437@SystematicSW.ab.ca> Date: Sun, 19 Jan 2025 09:38:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Bug] time(0x0) call extremely slow? Content-Language: en-CA To: cygwin AT cygwin DOT com References: Organization: Systematic Software In-Reply-To: X-Rspamd-Queue-Id: 1E57A6000C X-Stat-Signature: j3s4n3jxagaqde6xypxfa6wc3cc7a3j8 X-Rspamd-Server: rspamout03 X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1/lZf/kTrKgQutc9kFaHynn+Ph4F5wtLSc= X-HE-Tag: 1737304722-645908 X-HE-Meta: U2FsdGVkX1+/hOSlOc6J5Rg77uAmysrcfSqUjz4Zugek2eG2DbWy8rxKDO1C3ZrzQW7bRJHW4JnlXj4gfr5MmdXue4uDJT6C+dCfMSm9oH6trkS3QRxQiws+WNcez40mtC+XS4dZibttDca5RhJ42tZI2ZTQ8eMHbl4wYxborcYR7e3U1HpRKqmO7p9ZzFSCF/GtOQcLmUEUMVgkRlN+J/i2oeqA7K2gl+wcBQVCTs0E4FERW2jOgkBpEBghT/r8GOCv3xHo3bS27AcPrxOgpmyavCfEY/RPHMdpQ5usKCsB50PjtpMDtsPcfzWWOn/cZGxfuZaAr9ubG+3hD5iVLEiapPLRezyN X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 50JGdndU1791064 On 2025-01-19 05:55, Devste Devste via Cygwin wrote: > strace -o strace.log dirname -- /some/path/here > > Cygwin via Git for Windows 2.47.x > Windows 10 > > I see: >> 3249 60966 [main] dirname 31200 time: 1736590460 = time(0x0) > > On average it shows between 2000-4000 duration (I'm using Cloudflare's > ntp servers) which seems fishy to me, as this shouldn't be that slow? Remember this is a C program, running under C++ program strace, running under a C++ emulator cygwin, where other processes can run, including overhead which includes its own timing calls, and I don't believe strace takes account of that, so you are seeing wall clock durations and time counters, in µs I believe. I see these times, normally ~200us, although I do not know why time is being called in dirname? $ grep time ../dirname.strace 218 27334 [main] dirname (2604) time: 1737301093 = time(0x0) 181 29475 [main] dirname (2604) time: 1737301093 = time(0x0) 4352 101621 [main] dirname 50118 time: 1737301093 = time(0x0) These all appear to be converted from SystemTimePreciseAsFileTime; for accurate timing, you probably have to use rdtsc instructions directly to capture the times in a buffer; and calibrate using SystemTimePreciseAsFileTime, and do any conversions, after the fact. [Unless you are running a local Windows NTP server to discipline the time, w32tm service with DC time, or upstream remote NTP servers, are mostly irrelevant as they randomly bump the system time towards UTC.] -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- 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