How to measure CPU time with PSOC5? clock() always returns -1.

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

cross mob
Anonymous
Not applicable

I want an approximate time in seconds between 2 calls of a routine.

   

I don't need a lot of accuracy and I don't have any UDBs to spare for this trivial function. I have a function that can take from a few seconds to an hour or more of time to complete and want a gross measurement of the time that has passed by.

   

I tried using the clock() and the time() functions in C after including time.h but these functions always return -1 indicating an "error".

   

Is there some way to get these functions to work?

   

Can I use the ARM TICTIMER somehow?

   

 

   

For now I'm using a FF timer which at least doesn't use any UDBs but I would like to just use clock().

0 Likes
10 Replies