On Wed, 2012-02-08 at 00:16 +0100, Zygmunt Krynicki wrote:On 02/07/2012 11:43 PM, Andrew Richardson wrote:Which clock_t were you using? I think CLOCK_MONOTONIC makes sense forwhat you are trying to do and perhaps it has different resolution/accuracy.
Hrm. No, that shouldn't be the case. CLOCK_MONOTONIC and CLOCK_REALTIME
are driven by the same accumulation, and are only different by an
offset.
That said, in the test case you're using CLOCK_MONOTONIC_RAW, which I
don't think you really want, as its not NTP freq corrected. In addition
it is driven by some slightly different accumulation logic. But you
said CLOCK_REALTIME showed the same issue, so its probably not some
CLOCK_MONOTONIC_RAW specific bug.
If I crank up the amount of work done between the time calls(timetest.c:18: inneriters = 1e7;) such that the timed loop takes around72ms, the timing results seem accurate and none of the intermediatecalculations result in a 0us elapsed time. If I reduce it to around10-25ms (inneriters=1e6), I get occasional 0us elapsed times. Around 2ms(inneriters=1e5), most results measure an elapsed time of 0us.
Hrm. So I'm not familiar with the clocksource on panda. It may be so
coarse grained as to not allow for better intervals, but 2.5ms intervals
are a little outrageous. In the above you do have a 30us interval, so
clearly there are smaller intervals, so I doubt that is the real issue.
2.5ms is much closer to a tick length when HZ=300. Or a sched out and in
w/ HZ=1000.
I'm trying to optimize image processing functions, which take on theorder of 2-15ms to process. Am I stuck with this timing resolution? Iwant to be careful to not omit issues like cache performance whentiming, as I might if I repeatedly process an image to average theresults. Currently, that seems like the best option.
Might the compiler be out smarting you, and you end up with basically
two calls to clock_gettime() next to each other? Then it would be more
normal to see 0 ns time intervals (if the clocksource is somewhat coarse
grained), with the occasional scheduling blip hitting inbetween the
timings?
This explanation doesn't match your image timing results though, as I
assume you're doing actual work in that case.
Hmmm. I'm a little stumped. Can anyone closer to the OMAP hardware
comment?