- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to calculate my NIOS software execution time. My application need approx 3min(180 sec) to complete execution.(measured with a stopwatch)
I am using performance counter. As per its specs, it returns a 64 bit value. I am using DE2 board with 50MHz crystal. So as per my expectation, the counter should return (180*50,000,000) at the end, but its returning something in the range (40*50,000,000). What could be the reason?? My expected value completely comes under the 64 bit return value, so no case of re-loop. I am using: int main() { PERF_RESET(PERFORMANCE_COUNTER_0_BASE); PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE); PERF_BEGIN(PERFORMANCE_COUNTER_0_BASE,1); // Code Logic PERF_END(PERFORMANCE_COUNTER_0_BASE,1); PERF_STOP_MEASURING(PERFORMANCE_COUNTER_0_BASE); unsigned long long time; time = (unsigned long long)perf_get_section_time(performance_counter_0_base, 1); printf("\n\nTotal cycles consumed in FIR calculation = %llu cycles\n", time); } Please suggest.. Is their any other way to calculate exact real time??Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your problem sounds a little bit like your 64-bit value is being truncated to 32-bits due to a software bug; without exact expected/actual values it's hard to say.
Your problem could also be something like the wrong clock supplied to the performance counter block. As far as other time measurements go, you can use alt_nticks() for coarse, and a 64-bit Interval Timer for fine granularity; but the performance counter block you are already using works well, I just think you have some bug which is not obvious from your snippet.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ted,
After a hard time finding the bug, i designed my own IP block in verilog to count the clocks. Now it has perfect 64 bit resolution. Thanks for your suggestions.
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