Calculating Function Run Time

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

cross mob
DaSi_281136
Level 3
Level 3
25 replies posted 10 replies posted 5 replies posted

Hello,

Is there a way to to determine the run time of a function?
Normally I'll toggle a pin at the beginning and end of a function and measure with a scope.

That's obviously not a perfect solution as it includes the time to toggle the pin.

I figured there was a way to do this via Creator or during a debug run.

Thanks

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

DaSi,

You didn't mention processor type.

On PSoC4 and PSoC5  you can use a custom component StopWatch to measure elapsed CPU clocks

Re: How to get timestamp in microseconds using Psoc5lp

And for PSoC6

Measuring cycles using DTW on PSoC 6(M4)

/odissey1

View solution in original post

0 Likes
3 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

DaSi,

You didn't mention processor type.

On PSoC4 and PSoC5  you can use a custom component StopWatch to measure elapsed CPU clocks

Re: How to get timestamp in microseconds using Psoc5lp

And for PSoC6

Measuring cycles using DTW on PSoC 6(M4)

/odissey1

0 Likes

Thanks for the reply.

I'm using a PSOC5LP.

I'll take a look at using the stopwatch.

I'm hoping to the be able to get nanosecond resolution.

0 Likes

The StopWatch accuracy is 1 BUS_CLK, which at 80MHz translates into 12.5ns.

/odissey1

0 Likes