
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Respected Colleagues,
can somebody share a sample how to measure execution time inside the ARM DS-5 GCC application for Vybrid VF61 A5 core, because generic way (shown bellow) doesn't work. Variable clock_t can not be linked to a code no matter that the time.h is included. Result is always zero.
#include <time.h>
clock_t start, end;
double cpu_time_used;
start = clock();
... /* Do the work. */
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
Thanks in advance.
With best regards,
Dragan Kujovic
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Dragan,
We have verified your code with our Timesys toolchain ,clock function works as expected. Between the two successive clock functions, if you do the work with less than 1 unity i.e it executes in microseconds, will return zero. You can verify this with the precision of 10 floating point values in printf statement.
printf("cpu time used is %.10f \n",cpu_time_used);
Also you can try with gettimeofday() to get the execution time of your function.
Thanks,
Timesys Support

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Dragan,
We have verified your code with our Timesys toolchain ,clock function works as expected. Between the two successive clock functions, if you do the work with less than 1 unity i.e it executes in microseconds, will return zero. You can verify this with the precision of 10 floating point values in printf statement.
printf("cpu time used is %.10f \n",cpu_time_used);
Also you can try with gettimeofday() to get the execution time of your function.
Thanks,
Timesys Support

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your answer.
I think that something is wrong with project and compiling from ARM DS-5, because the variable clock_t is red underscored, but compiling pass without errors and warnings. time.h is included.
When I try from Linux shell "time sleep 2" it returns correct answer, but when I try it from application with reading
start = clock();
sleep(2); // 2 seconds
end = clock();
both start and end are populated with the same value, and because of that the result is allways zero.
I will try to further investigate this.
With best regards,
Dragan Kujovic


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dragan,
" I think that something is wrong with project and compiling from ARM DS-5, because the variable clock_t is red underscored, but compiling pass without errors and warnings. time.h is included."
Those problems in DS-5 are due the IDE is not able to find some symbols. You have to #include the correct file including the path.
Best Regards,
Alejandro


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you help with this case?
