[FX3] Get Time Spent?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HuYa_4249091
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi, I used the time.h to get the snippet code's time spent by C on PC, and it worked:

#include <time.h>
//in some function:
clock_t
start, end;
start = clock();
//some code...
end = clock();
float diff = end - start; //ms

 However, while testing the above code on FX3, the compiler showed error:

timesr.c:(.text+0x8): undefined reference to `_times'
collect2.exe: error: ld returned 1 exit status
cs-make: *** [Rheia.elf] Error 1

How to solve that? Or I need to use other way on FX3?

Any help will be highly appreciated!

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

It seems that you are trying to  get the execution time of the code using the timer ticks. 

If yes, please let me know if  you can you try using the CyU3PGetTime API from the FX3 SDK to get the number of elapsed OS timer ticks and based on that you would get the execution time in millisecond.

I just came across similar query on a forum

Regards,
Rashi

View solution in original post

3 Replies