delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/08/15:23:41

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <BAY113-DAV92173E4A278DEBD66AF11F5480@phx.gbl>
X-Sender: captain_webber AT hotmail DOT com
From: "Mr Webber" <captain_webber AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
References: <4783B96D DOT 9060709 AT huarp DOT harvard DOT edu> <BAY113-DAV35E3128C323B5B930C496F5480 AT phx DOT gbl> <4783C381 DOT 3020800 AT huarp DOT harvard DOT edu>
Subject: RE: Does clock() work?
Date: Tue, 8 Jan 2008 15:22:54 -0500
Message-ID: <1B96EE39888B44C2AE48CF45995D2E7C@windows.tecforth.com>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <4783C381.3020800@huarp.harvard.edu>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

 
Took another look and found that times(2), though not documented, is
available in Cygwin (as a macro in <sys/times.h>). Try it.  You should be
able to get "real" granular time with it, since it also returns a clock_t,
without massaging the data returned with any magic CONSTANTS that vary from
mach to mach, skewing the results.

-----Original Message-----
From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of
Norton Allen
Sent: Tuesday, January 08, 2008 1:40 PM
To: Mr Webber; cygwin AT cygwin DOT com
Subject: Re: Does clock() work?

Mr Webber wrote:
> CLOCKS_PER_SEC is a machine dependent macro, but not so machine 
> dependent to recognize that my 32-bit windows box has dual processors.  
> Not useful for benchmarking, is it.
>   
It's not quite clear to me why multiple processors would affect the
interpretation of CLOCKS_PER_SEC, or why such a simple model would not work
in a single-threaded app for basic benchmarking. I'm not talking about a
utility to launch commercial apps (which might be multithreaded, etc.),
just:

    * record the current time
    * do something single-threaded
    * record the current time and calculate elapsed time

> clock is not the way to go. It is a crude estimation of processor 
> time.  On regular UNIX times(2) is the function to use -- cygwin does 
> not seem to have it.
>   
Any other suggestions for timing resolution better than one second on
cygwin?

-Norton


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

- Raw text -


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