This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Does clock() work?


 
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@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of
Norton Allen
Sent: Tuesday, January 08, 2008 1:40 PM
To: Mr Webber; cygwin@cygwin.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]