File indexing completed on 2025-05-11 08:24:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifdef HAVE_CONFIG_H
0029 #include "config.h"
0030 #endif
0031
0032 #include <rtems/record.h>
0033 #include <rtems/score/threadimpl.h>
0034
0035 bool _Record_Thread_create(
0036 struct _Thread_Control *executing,
0037 struct _Thread_Control *created
0038 )
0039 {
0040 rtems_record_data data;
0041 char name[ 2 * THREAD_DEFAULT_MAXIMUM_NAME_SIZE ];
0042 rtems_record_item items[ 1 + sizeof( name ) / sizeof( data ) ];
0043 size_t len;
0044 size_t used;
0045
0046 items[ 0 ].event = RTEMS_RECORD_THREAD_CREATE;
0047 items[ 0 ].data = created->Object.id;
0048
0049 len = _Thread_Get_name( created, name, sizeof( name ) );
0050 used = _Record_String_to_items(
0051 RTEMS_RECORD_THREAD_NAME,
0052 name,
0053 len,
0054 &items[ 1 ],
0055 RTEMS_ARRAY_SIZE( items ) - 1
0056 );
0057 rtems_record_produce_n( items, used + 1 );
0058
0059 return true;
0060 }
0061
0062 void _Record_Thread_start(
0063 struct _Thread_Control *executing,
0064 struct _Thread_Control *started
0065 )
0066 {
0067 rtems_record_produce(
0068 RTEMS_RECORD_THREAD_START,
0069 started->Object.id
0070 );
0071 }
0072
0073 void _Record_Thread_restart(
0074 struct _Thread_Control *executing,
0075 struct _Thread_Control *restarted
0076 )
0077 {
0078 rtems_record_produce(
0079 RTEMS_RECORD_THREAD_RESTART,
0080 restarted->Object.id
0081 );
0082 }
0083
0084 void _Record_Thread_delete(
0085 struct _Thread_Control *executing,
0086 struct _Thread_Control *deleted
0087 )
0088 {
0089 rtems_record_produce(
0090 RTEMS_RECORD_THREAD_DELETE,
0091 deleted->Object.id
0092 );
0093 }
0094
0095 void _Record_Thread_switch(
0096 struct _Thread_Control *executing,
0097 struct _Thread_Control *heir
0098 )
0099 {
0100 rtems_record_item items[ 3 ];
0101
0102 items[ 0 ].event = RTEMS_RECORD_THREAD_SWITCH_OUT;
0103 items[ 0 ].data = executing->Object.id;
0104 items[ 1 ].event = RTEMS_RECORD_THREAD_STACK_CURRENT;
0105 items[ 1 ].data =
0106 #if defined(__GNUC__)
0107 (uintptr_t) __builtin_frame_address( 0 )
0108 - (uintptr_t) executing->Start.Initial_stack.area;
0109 #else
0110 0;
0111 #endif
0112 items[ 2 ].event = RTEMS_RECORD_THREAD_SWITCH_IN;
0113 items[ 2 ].data = heir->Object.id;
0114 rtems_record_produce_n( items, RTEMS_ARRAY_SIZE( items ) );
0115 }
0116
0117 void _Record_Thread_begin( struct _Thread_Control *executing )
0118 {
0119 rtems_record_produce(
0120 RTEMS_RECORD_THREAD_BEGIN,
0121 executing->Object.id
0122 );
0123 }
0124
0125 void _Record_Thread_exitted( struct _Thread_Control *executing )
0126 {
0127 rtems_record_produce(
0128 RTEMS_RECORD_THREAD_EXITTED,
0129 executing->Object.id
0130 );
0131 }
0132
0133 void _Record_Thread_terminate( struct _Thread_Control *executing )
0134 {
0135 rtems_record_produce(
0136 RTEMS_RECORD_THREAD_TERMINATE,
0137 executing->Object.id
0138 );
0139 }