Помогите плиз разобраться с Performance Counter Core! В чём разница, почему в одном случае количество клоков насчитанных счётчиком 36 а в другом - 24, операции между PERF_BEGIN и PERF_END остаются те же
1)-------------------------------------------------------------------------------------------------------------------------------------
int main(void) { int a = 10, b = 20, c; static int led = 0;
PERF_RESET(PERFORMANCE_COUNTER_BASE); PERF_START_MEASURING(PERFORMANCE_COUNTER_BASE); while(m<1000) { PERF_BEGIN(PERFORMANCE_COUNTER_BASE,1); c = a*b; led = led^0xFFFF; IOWR_ALTERA_AVALON_PIO_DATA(PIO_2_BASE, led); PERF_END(PERFORMANCE_COUNTER_BASE,1); m++; break; } PERF_STOP_MEASURING(PERFORMANCE_COUNTER_BASE); perf_print_formatted_report( (void *)PERFORMANCE_COUNTER_BASE, alt_get_cpu_freq(), 1, "section #1" ); return 0; }
--Performance Counter Report-- Total Time: 1E-06 seconds (150 clock-cycles) +---------------+-----+------------+----------------+--------------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+------------+----------------+--------------+ |section #1 | 24 | 0.00000| 36 | 1 | +---------------+-----+------------+----------------+--------------+
2)--------------------------------------------------------------------------------------------------------------------------------------
nt main(void) { int a = 10, b = 20, c; static int led = 0;
PERF_RESET(PERFORMANCE_COUNTER_BASE); PERF_START_MEASURING(PERFORMANCE_COUNTER_BASE); while(m<1000) { PERF_BEGIN(PERFORMANCE_COUNTER_BASE,1); c = a*b; led = led^0xFFFF; IOWR_ALTERA_AVALON_PIO_DATA(PIO_2_BASE, led); PERF_END(PERFORMANCE_COUNTER_BASE,1); m++; //break; } PERF_STOP_MEASURING(PERFORMANCE_COUNTER_BASE); perf_print_formatted_report( (void *)PERFORMANCE_COUNTER_BASE, alt_get_cpu_freq(), 1, "section #1" ); return 0; }
--Performance Counter Report-- Total Time: 0.000267507 seconds (40126 clock-cycles) +---------------+-----+------------+----------------+--------------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+------------+----------------+--------------+ |section #1 | 59.8| 0.00016 | 24012 | 1000 | +---------------+-----+------------+----------------+--------------+
|