Brian Stecher
|
Re: clock_gettime(CLOCK_REALTIME) accuracy and backend calls
|
Brian Stecher
05/27/2011 8:19 AM
post86195
|
Re: clock_gettime(CLOCK_REALTIME) accuracy and backend calls
clock_time() resolution is accurate to the timer tick rate - by default
1 millisecond. The only other generic mechanism is ClockCycles(). That
will (likely) have higher resolution, but there are potentially
wrap-around issues (e.g on some systems the maximum duration that
can be represented is very short (8 seconds is the lowest that I know of)).
Also, on SMP systems there's no guarantee that the ClockCycles() value
returned by one CPU has any relationship to the value returned by
another.
On Thu, May 26, 2011 at 11:16:09PM -0400, Yi Zhang wrote:
> Hi,
>
> I have a question about how clock_time with CLOCK_REALTIME is
> implemented in QNX 6.5.1.
> To my knowledge in Linux 2.6.20+, it's implemented in the following
> way(concisely):
> clock_gettime() ->
> glibc ->
> ---- kernel ----
> sys_clock_gettime() ->
> getnstimeofday() ->
> __get_nsec_offset()
>
> And __get_nsec_offset() returns a read from clock source hardware such
> as TSC in x86 chip.
> In reality it could be more complicated, but essentially it's like this.
>
> So, is that how QNX handles it too?
>
> The reason I asked is because I wonder the result returned from
> clock_gettime() is reliable or not? Reliable in the sense that the nano
> sec value is true and we can build our application upon that.
>
> Is there other system calls that give better timing control since QNX is
> a RTOS?
>
> Thanks very much!
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post86184
>
--
Brian Stecher (bstecher@qnx.com) QNX Software Systems
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8
|
|
|