Altera_Forum
Honored Contributor
19 years agoPerformance Counter offset
Hi, i have a question about the PERFORMANCE COUNTER component.
I have the following code to measure the overhead from starting/stoping the counter:PERF_BEGIN (PERFORMANCE_COUNTER_BASE, 1);
PERF_END (PERFORMANCE_COUNTER_BASE, 1); From the two lines above I always get a value of 3 clocks. So far so good. But when I measure the following code ... for (int x = 0; x < 10000; x++)
{
PERF_BEGIN (PERFORMANCE_COUNTER_BASE, 1);
a++;
PERF_END (PERFORMANCE_COUNTER_BASE, 1);
} ... I get a result of 10012 clocks http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/unsure.gif Is the offset value of 3 clocks constant or not? It seems not to be because then I would expect a value of ~ 40000 clocks ( 10000 * (1 clock + 3 clock offset) ) What is the error in reasoning ?