This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Measuring code execution time

hi,

I would like to do some code profiling and measure execution time. What is a lowest possible resolution for the counter is possible to achieve and how?

I am currently using RTC counter nrf_drv_rtc_counter_get() but have read that is not nessecery a good idea.

What would be other soft options for that?

Parents
  • FormerMember
    0 FormerMember

    The resolution of the RTC depends on the prescaler, see this section in the Product Specification (PS).

    A TIMER using the HFCLK will have higher resolution, see this section in the PS.

    Another option is to toggle a GPIO right before and right after the code where you want to measure the execution time, and then measure the execution time using a logic analyzer.

Reply
  • FormerMember
    0 FormerMember

    The resolution of the RTC depends on the prescaler, see this section in the Product Specification (PS).

    A TIMER using the HFCLK will have higher resolution, see this section in the PS.

    Another option is to toggle a GPIO right before and right after the code where you want to measure the execution time, and then measure the execution time using a logic analyzer.

Children
No Data
Related