GSoC Project | Basic Support for Trace Compass

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Aug 5 08:29:23 UTC 2019


On 05/08/2019 10:12, Ravindra Kumar Meena wrote:
>      > In the console output at someplace, I am getting this type of output:
>      >
>      > THREAD_ID:a01001e
>      > THREAD_NAME:737769363a207461
>      > THREAD_NAME:736b2071756575
>      >
>      > Does this mean that the same thread_id have two thread_name? If
>     so then
>      > only one thread_name can be stored in
>      > char thread_names[3][65536][THREAD_NAME_SIZE];
> 
>     No, it means that the thread name is longer than 8 bytes (on a 32-bit
>     target, it would be 4 bytes), see the loop here:
> 
>     https://git.rtems.org/rtems/tree/cpukit/libtrace/record/record-userext.c#n54
> 
>     To get the thread name back from the integers into a char array, you
>     have to reverse what this loop did.
> 
> Have made changes:
> https://github.com/rmeena840/rtems-tools/commit/a6701361eab030698464bab67d63a880d503c90e
> 
> Have a look.
> 
> The following line will give the same thread_name. There is no need to 
> reverse. I checked the output. The values are the same.
> snprintf( item_name_str, sizeof( item_name_str ), "%08"PRIx64, 
> item->data );

This change makes no sense.

1. If you store data from a previous record item to use it in the 
future, then you must always store this information per-CPU. So, this 
thread_id_name must be per-CPU.

2. Each of the RTEMS_RECORD_THREAD_NAME events, the item->data integer 
contains up to 4 or 8 chars.

https://git.rtems.org/rtems/tree/cpukit/libtrace/record/record-userext.c#n54

3. You don't need extra memcpy() calls, just store the string directly 
in ctx->thread_names[api_id][thread_id]. The first 
RTEMS_RECORD_THREAD_NAME uses 
ctx->thread_names[api_id][thread_id][0..7], the second uses 
ctx->thread_names[api_id][thread_id][8..15]. The third and later are an 
error, just ignore it.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list