On 02/07/2012 02:43 PM, Andrew Richardson wrote:
I'm experiencing what appears to be a minimum clock resolution issue
in using clock_gettime() on a PandaBoard ES running ubuntu.
Do you have CONFIG_OMAP_32K_TIMER enabled in your kernel?
Look at 'dmesg | grep clock' and check for the following:
...
OMAP clockevent source: GPTIMER1 at 32768 Hz
sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
...
Most probably this is the answer - by default, recent OMAPs are configured
to use less-accurate, but more energy-saving timer (32KHz) in favor of
MPU timer.
Disable CONFIG_OMAP_32K_TIMER to switch to MPU timer, and check
'dmesg | grep clock' to see:
...
OMAP clockevent source: GPTIMER1 at 38400000 Hz
OMAP clocksource: GPTIMER2 at 38400000 Hz
sched_clock: 32 bits at 38MHz, resolution 26ns, wraps every 111848ms
...
BTW, I have no ideas why clock_getres(CLOCK_REALTIME,...) returns {0, 1}
regardless of underlying clock source. I expect {0, 30517} for 32K timer
and {0, 26} for MPU timer.
Dmitry