
Ublas : 
From: Ian McCulloch (ianmcc_at_[hidden])
Date: 20060816 17:26:38
Fred wrote:
> Hi,
[snip]
> I don't understand why prod spends "0 sec" in some iterations and
> "0.016sec" (in my computer) if variables are always the same...
Further to what Brian has already said, 0.016 is exactly 1/60, so that is
surely the resolution of the timer you are using. You are timing just a
single 3x3 matrixvector multiply, so almost all of the results will show 0
seconds, except a small number that just happen to cross a clock edge.
i.e., 60 times a second the clock is incremented; the inner loop takes less
than 1/60 seconds to finish, but every so often the start and finish
straddle a clock edge. (Aside: can you see from that how you could get an
estimate for the time based on the final value of 'counter' ? )
Move the timer out of the inner loop, and increase the number of iterations
until the time taken is relatively large (a second or so).
Cheers,
Ian