Skip to contentSkip to conversation

Question about gettimeofday

DISCUSSION Subhash S 2 participants 2 messages Jul 31, 2001

lore
Share & tools
lore

Subhash S

author
#0 lore raw

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

begin:vcard
n:;Subhash
x-mozilla-html:FALSE
org:Oracle India;LINUX PERFORMANCE
adr:;;;;;;
version:2.1
email;internet:[email protected]
x-mozilla-cpt:;0
fn:Subhash
end:vcard

#1 lore raw
Quoted 6 lines · Subhash S

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.

Signature · 4 lines
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]