delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/01/07/13:40:33

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:reply-to
:message-id:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=cRWtXTQmrEsc1KFf
P0YSqCjLD06x7o3/THMl47wnMaSvgRvNg2s7dmfi5s9XzfrtYxgjo4fwDc8jALCk
ZVzoccuJinH3DEK7gHZ5Cxaye78gRbWu0zcJx/uzGDNructCe/d4dWNV0dlsJ7Sx
LpYdceoFmsSPejq7x0IqK2dYyKA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:reply-to
:message-id:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=N0u5X2s5myPDhzcMjOsRXP
44ZIE=; b=iZ6hcZuI3F28GtN0Uy/kaJNupP6Pe5W7F61UYgqa8qQZjzU2yTXzdq
siNwfhsGWZMAJmAbV2DjjYoNihre1foRyiu1zBjKIaS4hoo5jm4pM4VQZ4ymNbkW
Vqc/tIWiyS6jAoIFiKDwv56hvshd24Bz528tPcYXZ22k0UN1IUuP8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_MXURI,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=prince, Prince, H*F:D*aol.com, UD:mx.aol.com
X-HELO: omr-m020e.mx.aol.com
Reply-To: tprince AT intelretiree DOT com
Subject: Re: time command does not show CPU time for MinGW binaries
To: cygwin AT cygwin DOT com
References: <7f12e332ab2678dec61d4f11f3112b94 AT poradnik-webmastera DOT com>
From: "arrl via cygwin" <cygwin AT cygwin DOT com>
Reply-To: arrl <n8tm AT aol DOT com>
Message-ID: <22fec84a-26de-5bbd-4e49-5337cd8aedc4@aol.com>
Date: Sun, 7 Jan 2018 13:34:03 -0500
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <7f12e332ab2678dec61d4f11f3112b94@poradnik-webmastera.com>
x-aol-global-disposition: G
x-aol-sid: 3039ac1add8d5a5269934459
X-AOL-IP: 65.189.93.33
Note-from-DJ: This may be spam

On 1/7/2018 10:38 AM, daniel AT poradnik-webmastera DOT com wrote:
> time command does not show CPU time for MinGW binaries. I have this
> sample piece of code:
> 
> #include <stdio.h>
> #include <time.h>
> 
> #define N 100000
> #define K 10000
> 
> double data[N];
> 
> int main()
> {
>     clock_t t = clock();
>     for (unsigned long n = 0; n < N; ++n)
>         for (unsigned long k = 0; k < K; ++k)
>             data[n] += data[n] * data[k];
> 
>     t = clock() - t;
>     printf("Time %.3f\n", (double)t / CLOCKS_PER_SEC);
> 
>     return 0;
> }
> 
> When I compile it using Cygwin's gcc, time shows CPU time (user time) as
> expected:
> 
> $ gcc -o test test.c -O3
> $ time ./test
> Time 1.890
> 
> real    0m2,043s
> user    0m1,890s
> sys     0m0,000s
> 
> However when code is compiled using MinGW's gcc, time reports 0.000 as a
> user time. Note that clock() function still provides valid values:
> 
> $ x86_64-w64-mingw32-gcc -o test test.c -O3
> $ time ./test
> Time 1.889
> 
> real    0m1,998s
> user    0m0,000s
> sys     0m0,015s
> 
> I have updated Cygwin to latest version today.
> $ uname -r
> 2.9.0(0.318/5/3)
> 
> gcc (GCC) 6.4.0
> x86_64-w64-mingw32-gcc (GCC) 6.4.0
> 
> I am using Win10 Pro now. As I recall, it worked when I was using it
> about year ago on Win7 Pro. So it is probably Win10 issue.
> 
> Is this a known bug, or should I log a new one? Do you know if there is
> any workaround?
> 
> Daniel
> 

I'd be surprised if a past or present cygwin could capture user or full
sys time from a .exe not linked against cygwin dll.  clock() relies on
library code which is part of the .exe.


-- 
Tim Prince

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019