#2858 closed enhancement (fixed)
Add user defined thread names
Reported by: | Sebastian Huber | Owned by: | Sebastian Huber |
---|---|---|---|
Priority: | normal | Milestone: | 5.1 |
Component: | score | Version: | 5 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
Add user defined thread names to ease debugging, enhance the system diagnostics and improve compatibility to other systems, e.g. Linux and FreeBSD.
Implement pthread_setname_np() and pthread_getname_np(). Add CONFIGURE_MAXIMUM_THREAD_NAME_SIZE to the application configuration options. Add a application configuration dependent storage area for thread names to the thread control block.
Change History (16)
comment:1 Changed on 01/12/17 at 13:41:01 by Joel Sherrill
comment:2 Changed on 01/12/17 at 14:50:47 by Sebastian Huber
The problem with the object set/get name is that the interpretation of the Objects_Name depends on Objects_Information::is_string which is false for Classic and true for POSIX.
comment:3 Changed on 01/12/17 at 14:53:20 by Sebastian Huber
With the new thread name support I get now
[/] # cpuuse ------------------------------------------------------------------------------- CPU USAGE BY THREAD ------------+----------------------------------------+---------------+--------- ID | NAME | SECONDS | PERCENT ------------+----------------------------------------+---------------+--------- 0x09010001 | IDLE | 2.389090 | 71.877 0x0a010001 | UI1 | 0.214980 | 6.464 0x0a010002 | BSWP | 0.005139 | 0.154 0x0a010003 | BRDA | 0.001066 | 0.032 0x0a010004 | MDIA | 0.000583 | 0.017 0x0a010005 | TIME | 0.180753 | 5.430 0x0a010006 | IRQS | 0.004529 | 0.136 0x0a010007 | swi1: netisr 0 | 0.002570 | 0.077 0x0a010008 | kqueue_ctx task | 0.000676 | 0.020 0x0a010009 | swi5: fast task | 0.000059 | 0.001 0x0a01000a | thread taskq | 0.000058 | 0.001 0x0a01000b | swi6: task queu | 0.003285 | 0.098 0x0a01000c | DHCP | 0.274554 | 8.237 0x0a01000d | FTPa | 0.002210 | 0.066 0x0a01000e | FTPb | 0.000352 | 0.010 0x0a01000f | FTPc | 0.000240 | 0.007 0x0a010010 | FTPd | 0.000347 | 0.010 0x0a010011 | FTPD | 0.002903 | 0.087 0x0a010012 | TNTD | 0.001117 | 0.033 0x0a010013 | SHLL | 0.253692 | 7.599 ------------+----------------------------------------+---------------+--------- TIME SINCE LAST CPU USAGE RESET IN SECONDS: 3.338494 -------------------------------------------------------------------------------
Before all the libbsd threads had the name "_BSD".
comment:4 Changed on 01/12/17 at 16:18:27 by Joel Sherrill
I am missing something in the code about how a Classic API task can have a string name.
What about names for threads created using the new lightweight API? And do they show up in these lists.
comment:5 Changed on 01/12/17 at 16:33:21 by Sebastian Huber
See patch:
https://lists.rtems.org/pipermail/devel/2017-January/016680.html
The optional string name is accessible via Thread_Control::Join_queue::Queue::name.
comment:6 Changed on 01/13/17 at 07:34:32 by Sebastian Huber <sebastian.huber@…>
comment:7 Changed on 01/13/17 at 07:34:42 by Sebastian Huber <sebastian.huber@…>
comment:8 Changed on 01/13/17 at 07:34:52 by Sebastian Huber <sebastian.huber@…>
comment:9 Changed on 01/13/17 at 07:35:01 by Sebastian Huber <sebastian.huber@…>
comment:10 Changed on 01/13/17 at 07:35:11 by Sebastian Huber <sebastian.huber@…>
comment:11 Changed on 01/13/17 at 08:21:31 by Sebastian Huber <sebastian.huber@…>
comment:12 Changed on 01/31/17 at 09:11:16 by Sebastian Huber <sebastian.huber@…>
comment:13 Changed on 01/31/17 at 09:11:57 by Sebastian Huber
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:14 Changed on 02/14/17 at 10:13:42 by Sebastian Huber <sebastian.huber@…>
comment:15 Changed on 05/11/17 at 07:31:02 by Sebastian Huber
Milestone: | 4.12 → 4.12.0 |
---|
comment:16 Changed on 11/09/17 at 06:27:14 by Sebastian Huber
Milestone: | 4.12.0 → 5.1 |
---|
Milestone renamed
This shouldn't be hard to add since rtems_object_[gs]et_name() were added to do the same thing. These have been in since before 4.10. See psx14 for an example usage of rtems_object_set_name() on a pthread.