I am trying to do some benchmark/optimization on some source code using this code:
rtiInit();
rtiStopCounter(rtiCOUNTER_BLOCK0);
if (rtiResetCounter(rtiCOUNTER_BLOCK0))
{
rtiStartCounter(rtiCOUNTER_BLOCK0);
}
CodeToBenchmark();
Elapsed_Count = rtiGetCurrentTick(rtiCOMPARE0);
rtiStopCounter(rtiCOUNTER_BLOCK0);
Sometime the results seem to make sense, but at other times, the 'Elapsed_Count' looks random. It does not look like an overrun issue since I try to keep the 'CodeToBenchmark()' processing very small.
Anyone have an idea of how to fix this problem?