X-Recipient: archive-cygwin@delorie.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:mime-version:content-type
	:content-transfer-encoding:date:from:to:subject:message-id; q=
	dns; s=default; b=PJacAXY0zwhhjWVgHSRGJA29UvD5m+D9kbdKu6FB7L1NwX
	iayAHk82wfdeBYZBJGmpbqdAOJxW9f1PzNA976AOmISVoUuNSep2NUvTtDJ0TaD0
	eIvZQPQ+e5SClNRoflkVQgr2E/k5Osk+lgcx8ipqRA8umgeNqloBeW6yDTwc0=
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:mime-version:content-type
	:content-transfer-encoding:date:from:to:subject:message-id; s=
	default; bh=P132TwLq7dJ/l3MO9BwptPoyQAY=; b=UmsgJ/0HHfwnIlI0O0tb
	+K3A4jL5qNRQg7Hm2fybMcZ/qxOunJvIZrD9aR9wuT1H6HPL7t1sNXwe7gC8XRMS
	I+8ZohM2vnTRfsDWyYQ2SeruycdmdnzQZ9bJRKBsBFGJlcRk+8JHCii1CEOsPQIl
	SpulOMcUlNIafu8hfBh4Gk8=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*u:1.3.3, H*UA:1.3.3, H*F:U*daniel, HX-Envelope-From:sk:daniel@
X-HELO: da.nameserverus2.com
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding: 7bit
Date: Sun, 07 Jan 2018 16:38:21 +0100
From: daniel@poradnik-webmastera.com
To: cygwin@cygwin.com
Subject: time command does not show CPU time for MinGW binaries
Message-ID: <7f12e332ab2678dec61d4f11f3112b94@poradnik-webmastera.com>
X-Sender: daniel@poradnik-webmastera.com
User-Agent: Roundcube Webmail/1.3.3
X-Antivirus-Scanner: Clean mail though you should still use an Antivirus
X-Authenticated-Id: daniel@poradnik-webmastera.com
X-IsSubscribed: yes

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

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

