File indexing completed on 2025-05-11 08:24:13
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
0029
0030
0031
0032
0033
0034
0035
0036
0037 #ifndef _RTEMS_SCORE_PROFILING
0038 #define _RTEMS_SCORE_PROFILING
0039
0040 #include <rtems/score/percpu.h>
0041 #include <rtems/score/isrlock.h>
0042
0043 #ifdef __cplusplus
0044 extern "C" {
0045 #endif
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 static inline void _Profiling_Thread_dispatch_disable(
0066 Per_CPU_Control *cpu,
0067 uint32_t previous_thread_dispatch_disable_level
0068 )
0069 {
0070 #if defined( RTEMS_PROFILING )
0071 if ( previous_thread_dispatch_disable_level == 0 ) {
0072 Per_CPU_Stats *stats = &cpu->Stats;
0073
0074 stats->thread_dispatch_disabled_instant = _CPU_Counter_read();
0075 ++stats->thread_dispatch_disabled_count;
0076 }
0077 #else
0078 (void) cpu;
0079 (void) previous_thread_dispatch_disable_level;
0080 #endif
0081 }
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094 static inline void _Profiling_Thread_dispatch_disable_critical(
0095 Per_CPU_Control *cpu,
0096 uint32_t previous_thread_dispatch_disable_level,
0097 const ISR_lock_Context *lock_context
0098 )
0099 {
0100 #if defined( RTEMS_PROFILING )
0101 if ( previous_thread_dispatch_disable_level == 0 ) {
0102 Per_CPU_Stats *stats = &cpu->Stats;
0103
0104 stats->thread_dispatch_disabled_instant = lock_context->ISR_disable_instant;
0105 ++stats->thread_dispatch_disabled_count;
0106 }
0107 #else
0108 (void) cpu;
0109 (void) previous_thread_dispatch_disable_level;
0110 (void) lock_context;
0111 #endif
0112 }
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 static inline void _Profiling_Thread_dispatch_enable(
0124 Per_CPU_Control *cpu,
0125 uint32_t new_thread_dispatch_disable_level
0126 )
0127 {
0128 #if defined( RTEMS_PROFILING )
0129 if ( new_thread_dispatch_disable_level == 0 ) {
0130 Per_CPU_Stats *stats = &cpu->Stats;
0131 CPU_Counter_ticks now = _CPU_Counter_read();
0132 CPU_Counter_ticks delta = now - stats->thread_dispatch_disabled_instant;
0133
0134 stats->total_thread_dispatch_disabled_time += delta;
0135
0136 if ( stats->max_thread_dispatch_disabled_time < delta ) {
0137 stats->max_thread_dispatch_disabled_time = delta;
0138 }
0139 }
0140 #else
0141 (void) cpu;
0142 (void) new_thread_dispatch_disable_level;
0143 #endif
0144 }
0145
0146
0147
0148
0149
0150
0151
0152 static inline void _Profiling_Update_max_interrupt_delay(
0153 Per_CPU_Control *cpu,
0154 CPU_Counter_ticks interrupt_delay
0155 )
0156 {
0157 #if defined( RTEMS_PROFILING )
0158 Per_CPU_Stats *stats = &cpu->Stats;
0159
0160 if ( stats->max_interrupt_delay < interrupt_delay ) {
0161 stats->max_interrupt_delay = interrupt_delay;
0162 }
0163 #else
0164 (void) cpu;
0165 (void) interrupt_delay;
0166 #endif
0167 }
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179 void _Profiling_Outer_most_interrupt_entry_and_exit(
0180 Per_CPU_Control *cpu,
0181 CPU_Counter_ticks interrupt_entry_instant,
0182 CPU_Counter_ticks interrupt_exit_instant
0183 );
0184
0185
0186
0187 #ifdef __cplusplus
0188 }
0189 #endif
0190
0191 #endif