nRF Connect SDK v2.1.1 build errors on thread_analyzer.c

Hello Community & Nordic support,

Observed behaviour:
my project build with nRF Connect SDk v2.1.1 was with errors

expected behaviour:
my project build with nRF Connect SDk v2.1.1 was OK

Description:
I recently switch fro
m nRF Connect SDK v2.0.2 to v2.1.1

The build with v2.0.2 went fine.
The build with v2.1.1 went bad see below:


My proj.conf (related to the issue)

CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_NAME=y

CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_RUNTIME_STATS=y

I recently switch from nRF Connect SDK v2.0.2 to v2.1.1

The build with v2.0.2 went fine.
The build with v2.1.1 went bad see below:

MF zephyr\CMakeFiles\zephyr.dir\subsys\debug\thread_analyzer.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/subsys/debug/thread_analyzer.c.obj -c C:/cm/ncs/v2.1.1/zephyr/subsys/debug/thread_analyzer.c
C:/cm/ncs/v2.1.1/zephyr/subsys/debug/thread_analyzer.c: In function 'thread_analyze_cb':
C:\cm\ncs\v2.1.1\zephyr\subsys\debug\thread_analyzer.c:114:46: error: 'struct thread_analyzer_info' has no member named 'usage'
  114 |  if (k_thread_runtime_stats_get(thread, &info.usage) != 0) {
      |                                              ^
C:\cm\ncs\v2.1.1\zephyr\subsys\debug\thread_analyzer.c:122:27: error: 'struct thread_analyzer_info' has no member named 'usage'
  122 |   info.utilization = (info.usage.execution_cycles * 100U) /
      |                           ^
C:\cm\ncs\v2.1.1\zephyr\subsys\debug\thread_analyzer.c:123:16: error: 'k_thread_runtime_stats_t' {aka 'struct k_thread_runtime_stats'} has no member named 'execution_cycles'
  123 |    rt_stats_all.execution_cycles;
      |                ^
[35/269] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_cmds.c.obj

Parents Reply Children
  • Hi Susheel 

    I use the thread analyzer within my client project and worked fine for months.
    Since the upgrade to ncs v2.1.1 is give me a build error.

    Like you mention you have changes some example and tested it .

    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_ANALYZER_USE_PRINTK=y
    CONFIG_THREAD_ANALYZER_AUTO=y
    CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
    CONFIG_THREAD_STACK_INFO=y
    CONFIG_THREAD_NAME=y
    CONFIG_THREAD_RUNTIME_STATS=y

    What i try to say is 
    you did not the same as i did (hence we are comparing (apple versus peer)

    based on what you explain you call the thread analyzer different then how I do it.

    Can you please compile it without
    CONFIG_THREAD_ANALYZER_AUTO=y
    CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
    but with 
    CONFIG_THREAD_MONITOR=n


    Because having this settings CONFIG_THREAD_ANALYZER_AUTO=y   
    means a stand-alone thread run the analyzer and dumps the print in the log.
    This is a complete different behavior the  my project

    where i run the thread analyzer from the rtt with a custom shell command.
    #include <debug/thread_analyzer.h>

    #if IS_ENABLED(CONFIG_THREAD_ANALYZER)

            // Run the thread analyzer and prints the output in standard form.
            thread_analyzer_print();
    #endif

    best regards,
       nRFxFanBoy


  • tried now with

    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_ANALYZER_USE_PRINTK=y
    #CONFIG_THREAD_ANALYZER_AUTO=y
    #CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
    CONFIG_THREAD_STACK_INFO=y
    CONFIG_THREAD_NAME=y
    CONFIG_THREAD_RUNTIME_STATS=y
    CONFIG_THREAD_MONITOR=n

    changed the ble_write_thread to below in peripheral_uart example

    void ble_write_thread(void)
    {
    	/* Don't go any further until BLE is initialized */
    	k_sem_take(&ble_init_ok, K_FOREVER);
    
    	for (;;) {
    		// Run the thread analyzer and prints the output in standard form.
            thread_analyzer_print();
    
    		/* Wait indefinitely for data to be sent over bluetooth */
    		struct uart_data_t *buf = k_fifo_get(&fifo_uart_rx_data,
    						     K_FOREVER);
    
    		if (bt_nus_send(NULL, buf->data, buf->len)) {
    			LOG_WRN("Failed to send data over BLE connection");
    		}
    
    		k_free(buf);
    	}
    }

    and get the stats when I press new line character in the serial terminal

    This means that the feature is working as it should and the auto refresh thing is disabled.

    I do not know what your setup is but have you tested this in the peripheral_uart (or any other sample) other than your setup?

    It seems like the errors you are seeing have some conflicting structs definitions of the thread analyzer which I am not able to reproduce.

Related