- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
I am facing the same problem . Were you able to solve the problem? Can anyone tell me the cause of the problem if they have faced similar issue. thanks. --- Quote Start --- 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. --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Not actually but found a work around, i made a new design in the SOPC builder which just had NIOSII Processor, 20KB of On Chip-RAM, JTAG-UART, Performance Counter Unit. Then I enabled small C libraries in NIOSII-IDE and ran the same code and got the correct cycle count
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page