Skip to contentSkip to conversation

CLOCK_MONOTONIC issue

DISCUSSION Giuliano Colla 2 participants 3 messages Jun 22, 2015

lore
Share & tools
lore
#0 lore raw

Hi all,

in order both to profile the performance of my rt threads, and to perform timed operations (such as sem_timedwait), I'm using the clock_gettime() function.

Using as a parameter CLOCK_REALTIME everything appears to work as expected, but if I attempt to use CLOCK_MONOTONIC (which should be a more reliable timing source, from what I read), I get bogus times.

This occurs on different platforms, and with different kernel versions/rt patch. (3.10.10-rt7 - 3.10.67-rt71 - 3.12.31-rt45).

Am I missing something obvious, such as a kernel misconfiguration, or this is something to be expected?

Any hint will be appreciated.

Thanks in advance,

Giuliano

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in

#1 lore raw
Quoted 3 lines · Giuliano Colla

Using as a parameter CLOCK_REALTIME everything appears to work as expected, but if I attempt to use CLOCK_MONOTONIC (which should be a more reliable timing source, from what I read), I get bogus times.

What do you mean by "bogus times"?

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in

#2 lore raw

Il 22/06/2015 13:40, Richard Cochran ha scritto:

Quoted 5 lines · Giuliano Colla
Quoted 3 lines

Using as a parameter CLOCK_REALTIME everything appears to work as expected, but if I attempt to use CLOCK_MONOTONIC (which should be a more reliable timing source, from what I read), I get bogus times.

What do you mean by "bogus times"?

I mean that the timing of sem_timedwait() appears to be inconsistent with the requested values.
But I believe I've found the reason in the meantime.
According the documentation, sem_timedwait() uses CLOCK_REALTIME, and it would appear that it can't be configured differently. If I supply an absolute time value calculated from a different clock source, of course I'm bound to find inconsistencies!

Thanks however.

Giuliano

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in