2001-07-31 06:42:28

by Subhash S

[permalink] [raw]
Subject: Question about gettimeofday

Hi All,

In my application I use gettimeofday very frequently, as it is system
call on linux it is expensive, where as on Solaris it is not so. Could
you please tell me how solaris is implemented the function gettimeofday.

Please reply directly to me as I am not there in the mailing list.

Thanks,
Subhash


Attachments:
subhash.sutrave.vcf (183.00 B)
Card for Subhash S

2001-07-31 13:29:31

by Chris Friesen

[permalink] [raw]
Subject: Re: Question about gettimeofday

Subhash S wrote:
>
> Hi All,
>
> In my application I use gettimeofday very frequently, as it is system
> call on linux it is expensive, where as on Solaris it is not so. Could
> you please tell me how solaris is implemented the function gettimeofday.

While I can't tell you how Solaris implemented it, I can say that in general if
you want very frequent timing access you're probably better off using inline
assembly to get at some processor-specific timer. On a 400Mhz G4, the
difference was about a microsecond for gettimeofday() vs about 25 nanoseconds
for the assembly code.


--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: [email protected]