Altera_Forum
Honored Contributor
13 years agoProblem with Performance Counter Unit
Hi I am trying to measure the number of clock cycles in NIOS2-Eclipse for a C Code using the Performance Counter and I get number of clock cycles as "-1".
I have used Altera's DE1-NIOS reference design and added the performance counter unit using SOPC builder. My Code is posted below, please tell me what I have done wrong. Thanks a lot..... Code : # include <stdio.h># include <system.h># include <altera_avalon_performance_counter.h> int main() { PERF_RESET(PERFORMANCE_COUNTER_0_BASE); PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE); printf("HELLO WORLD!!\n"); PERF_STOP_MEASURING(PERFORMANCE_COUNTER_0_BASE); perf_print_formatted_report ((void *)PERFORMANCE_COUNTER_0_BASE,ALT_CPU_FREQ,1,"FFT"); return 0; } Output I get : HELLO WORLD!! --Performance Counter Report-- Total Time: 1.84467E+11 seconds (-1 clock-cycles) +---------------+-----+-----------+---------------+-----------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+-----------+---------------+-----------+ |FFT | 100|184467440737.09552| -1| 100002| +---------------+-----+-----------+---------------+-----------+ Thanks.