Measuring execution time with timing.h

Hi, there i want to measure code execution time of a function. I came across https://docs.zephyrproject.org/latest/reference/timing_functions/index.html. I have enabled CONFIG_TIMING_FUNCTIONS on my prj.conf file. However the build cannot link to the timing functions. I get undefined references to both board_timing functions and soc_timing functions. How can i fix this. Additionally is there a better way to measure code execution time ?

Parents
  • anybidy got the answer? I also trrying to use this function but got error undefined references to timer function.

    For example

     

    C:\nrf\example\button\src\main.c:21: undefined reference to `soc_timing_init'
     

    I already add some c++ in configuration files.

    Below is my configuration files.

    # Include C++ Support
    CONFIG_CPLUSPLUS=y
    
    #include std c/c++, do not remove else standard design patterns will not work
    CONFIG_NEWLIB_LIBC=y
    CONFIG_LIB_CPLUSPLUS=y
    
    # Log
    CONFIG_LOG=y
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG_BACKEND_UART=y
    
    # Timer
    CONFIG_TIMING_FUNCTIONS=y
    
    # GPIO
    CONFIG_GPIO=y
    
    

    Anybody have solution for this? thanks.

Reply
  • anybidy got the answer? I also trrying to use this function but got error undefined references to timer function.

    For example

     

    C:\nrf\example\button\src\main.c:21: undefined reference to `soc_timing_init'
     

    I already add some c++ in configuration files.

    Below is my configuration files.

    # Include C++ Support
    CONFIG_CPLUSPLUS=y
    
    #include std c/c++, do not remove else standard design patterns will not work
    CONFIG_NEWLIB_LIBC=y
    CONFIG_LIB_CPLUSPLUS=y
    
    # Log
    CONFIG_LOG=y
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG_BACKEND_UART=y
    
    # Timer
    CONFIG_TIMING_FUNCTIONS=y
    
    # GPIO
    CONFIG_GPIO=y
    
    

    Anybody have solution for this? thanks.

Children
Related