Re: Question about gettimeofday

Chris Friesen (cfriesen@nortelnetworks.com)
Tue, 31 Jul 2001 09:29:19 -0400


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: cfriesen@nortelnetworks.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/