- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I used the following code to measure 1usec in baremetal NIOS application.
PERF_RESET (NIOS_PERFORMANCE_COUNTER_BASE);
PERF_START_MEASURING (NIOS_PERFORMANCE_COUNTER_BASE);
PERF_BEGIN (NIOS_PERFORMANCE_COUNTER_BASE,MY_PERF_ID);
usleep (1);
PERF_END (NIOS_PERFORMANCE_COUNTER_BASE,MY_PERF_ID);
time = perf_get_section_time (NIOS_PERFORMANCE_COUNTER_BASE, MY_PERF_ID);
But according to the clock value, the time is ~2usec, not ~1.
Can you please tell what is wrong in my code ?
Thank you in advance,
Zvika
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The return value is clock cycle, not usec.
2 means your measured result is 2 clock cycles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm aware the time is measured in clocks.
After converting clocks to usec, the measured time is ~2usec.
But the delay is exactly 1usec ( usleep(1) )
Is there an alternative for measuring the clock cycles ?
Thank you,
Zvika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your code is measuring the number of clock cycles to finish execute usleep(1), not measuring the delay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for your reply.
How can I measure exactly the time a specified code is running ? (in clocks)
For example: If the code is usleep (1), I expect that NofClocks * Frequency ~ 1usec
Best regards,
Zvika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may refer to Nios profiling below.
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/an/an391.pdf

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page