time in nanoseconds?

time in nanoseconds?

Post by Philip Koblenc » Sat, 08 Sep 2001 08:49:21



What facilities are available in unix to get number of elased time in
nanoseconds?
 
 
 

time in nanoseconds?

Post by David Schwart » Sat, 08 Sep 2001 09:29:19



> What facilities are available in unix to get number of elased time in
> nanoseconds?

        What UNIX on what processor?

        DS

 
 
 

time in nanoseconds?

Post by Andrew Gabri » Sat, 08 Sep 2001 09:25:01




Quote:> What facilities are available in unix to get number of elased time in
> nanoseconds?

clock_gettime() for those unixs which have this realtime extension
(which isn't all by any means).

--
Andrew Gabriel

 
 
 

time in nanoseconds?

Post by Philip Koblenc » Sat, 08 Sep 2001 11:28:36


Solaris 7 (sparc)



> > What facilities are available in unix to get number of elased time in
> > nanoseconds?

> What UNIX on what processor?

> DS

 
 
 

time in nanoseconds?

Post by David Schwart » Sat, 08 Sep 2001 11:46:41



> Solaris 7 (sparc)

struct timespec ts;
if(clock_gettime(CLOCK_REALTIME, &ts)==0)
{
 /* oh well, can't get nanoseconds */
Quote:}

else
{
 /* Yeah, nanoseconds are now in 'ts' */

Quote:}

        DS
 
 
 

time in nanoseconds?

Post by David Schwart » Sat, 08 Sep 2001 12:00:31


http://www.opengroup.org/onlinepubs/007908799/xsh/clock_getres.html

DS

 
 
 

time in nanoseconds?

Post by David Schwart » Sat, 08 Sep 2001 12:03:27



> http://www.opengroup.org/onlinepubs/007908799/xsh/clock_getres.html

> DS

        Sorry to reply to my reply to my reply, but don't forget to use
'-lposix4' when you link, and be warned, the resolution is probably only
millisecond anyway.

        DS

 
 
 

time in nanoseconds?

Post by Alex Colvi » Sun, 09 Sep 2001 00:27:40


Quote:> What facilities are available in unix to get number of elased time in
> nanoseconds?

multiplication by 1.0E9?

(sorry, couldn't resist...)

 
 
 

time in nanoseconds?

Post by Donald McLachl » Sun, 09 Sep 2001 04:15:06


gethrtime()


> Solaris 7 (sparc)




> > > What facilities are available in unix to get number of elased time in
> > > nanoseconds?

> > What UNIX on what processor?

> > DS

--

Communications Research Centre / RNS    Tel     (613) 998-2845
3701 Carling Ave.,                      Fax     (613) 998-9648
Ottawa, Ontario
K2H 8S2
Canada
 
 
 

time in nanoseconds?

Post by Norman Blac » Sun, 09 Sep 2001 06:09:00


gettimeofday has the highest resolution capability of any API I know of. It
is a very portable API. The resolution you actually get out of a specific
hardware, operating system combination... I do not have enough experience to
comment on that.

--
Norman Black
Stony Brook Software
nospam => stonybrk


Quote:> What facilities are available in unix to get number of elased time in
> nanoseconds?

 
 
 

time in nanoseconds?

Post by David Schwart » Sun, 09 Sep 2001 07:03:19



> gettimeofday has the highest resolution capability of any API I know of. It
> is a very portable API. The resolution you actually get out of a specific
> hardware, operating system combination... I do not have enough experience to
> comment on that.

        The gettimeofday function typically has microsecond resolution. Many
platforms (in fact, all Pentium platforms) can do better than that.

        DS

 
 
 

time in nanoseconds?

Post by David Schwart » Fri, 14 Sep 2001 05:03:42



> clock_gettime() for those unixs which have this realtime extension
> (which isn't all by any means).

        By the way, an odd quirk I've discovered on many Solaris machines is
that they report the resolution as being one millisecond but it's
actually much higher.

        DS

 
 
 

time in nanoseconds?

Post by Donald McLachl » Fri, 14 Sep 2001 10:06:57


I'm curious, how did you reach this conclusion?
In the past I have called gettimeofday 1001 times (computing 1000 delta's).
It was a while ago and I'm going from memory, but I think I found the min delta
was 1 msec.

--

Communications Research Centre / RNS    Tel     (613) 998-2845
3701 Carling Ave.,                      Fax     (613) 998-9648
Ottawa, Ontario
K2H 8S2
Canada

 
 
 

time in nanoseconds?

Post by Casper H.S. Dik - Network Security Engine » Fri, 14 Sep 2001 17:04:49


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]



>> clock_gettime() for those unixs which have this realtime extension
>> (which isn't all by any means).
>    By the way, an odd quirk I've discovered on many Solaris machines is
>that they report the resolution as being one millisecond but it's
>actually much higher.

It apparently returns timer resolution, not clock resolution.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

time in nanoseconds?

Post by Casper H.S. Dik - Network Security Engine » Fri, 14 Sep 2001 17:16:06


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]


>I'm curious, how did you reach this conclusion?
>In the past I have called gettimeofday 1001 times (computing 1000 delta's).
>It was a while ago and I'm going from memory, but I think I found the min delta
>was 1 msec.

Which OS?

There are many different implementations but the one SunOS 4.x/5.x one
on SPARC hardware has returned an number of microseconds derived from a
timer chip such that it gave a better resolution than 10ms.
(Similarly on Intel)

On a US-II 450MHz the typical granularity is 225ns (i.e., on five consecutive
calls, 3 deltas will be 0 and one will be 1)

On US-III based systems, the granularity appears to be 200ns and not 1ns.

On early BSD based systems, each lock tick would increment the time
with 10000us; however, multiple consecutive calls would get a difference
of 1 until the next clock tick so timestamps are uniq.

Modern systems are too fast for that.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.