Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xenlib: internal threads doesn't have names which makes thread_analyzer output not informative #84

Open
GrygiriiS opened this issue May 9, 2024 · 0 comments

Comments

@GrygiriiS
Copy link

GrygiriiS commented May 9, 2024

The thread_analyzer produces output with thread addresses and no names, as result impossible to say which thread is where.

To Zephyr thread_analyzer enable use:

 -DCONFIG_THREAD_ANALYZER=y \
 -DCONFIG_THREAD_ANALYZER_USE_PRINTK=y \
 -DCONFIG_THREAD_ANALYZER_AUTO=y \
 -DCONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
Thread analyze:                                                                                                       
 0x80c1700           : STACK: unused 3632 usage 464 / 4096 (11 %); CPU: 0 % 
^^^^^^^^^^^^^^^^^^                                          
      : Total CPU cycles used: 78879
 0x80c12f0           : STACK: unused 3632 usage 464 / 4096 (11 %); CPU: 0 %
      : Total CPU cycles used: 71
 thread_analyzer     : STACK: unused 0 usage 1024 / 1024 (100 %); CPU: 1 %
      : Total CPU cycles used: 228061711
 0x80bed10           : STACK: unused 3056 usage 1040 / 4096 (25 %); CPU: 0 %
      : Total CPU cycles used: 23777
 sysworkq            : STACK: unused 3712 usage 384 / 4096 (9 %); CPU: 0 %
      : Total CPU cycles used: 23
 shell_uart          : STACK: unused 1696 usage 2400 / 4096 (58 %); CPU: 0 %
      : Total CPU cycles used: 4750908
 idle                : STACK: unused 3696 usage 400 / 4096 (9 %); CPU: 98 %
      : Total CPU cycles used: 15343969381
 ISR0                : STACK: unused 6512 usage 1680 / 8192 (20 %)

Thread names has to be added as:

	k_thread_name_set(&context->rx_thread, "name");

-- or --
  
	if (IS_ENABLED(CONFIG_THREAD_NAME)) {
		char name[THREAD_MAX_NAME_LEN];

		snprintk(name, sizeof(name), "name-%", <param>);
		k_thread_name_set(ctx->rx_thread, name);
	}
@GrygiriiS GrygiriiS changed the title xenlib: internal threads doesn't have names which makes thread_analyzer output not inforamtive xenlib: internal threads doesn't have names which makes thread_analyzer output not informative May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant