diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-18 11:09:14 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 15:14:33 +0200 |
commit | d5423295988918f45b64d50cf0b9501a56b9aa36 (patch) | |
tree | de09916f70f4f10b47cf080e7149c1cef2c47198 /cpukit/score/include/rtems/score/profiling.h | |
parent | score: Replace _Thread_Delay_ended() (diff) | |
download | rtems-d5423295988918f45b64d50cf0b9501a56b9aa36.tar.bz2 |
score: _Thread_Dispatch_disable_critical()
Thread dispatching is disabled in case interrupts are disabled. To get
an accurate thread dispatch disabled time it is important to use the
interrupt disabled instant in case a transition from an interrupt
disabled section to a thread dispatch level section happens.
Diffstat (limited to 'cpukit/score/include/rtems/score/profiling.h')
-rw-r--r-- | cpukit/score/include/rtems/score/profiling.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/profiling.h b/cpukit/score/include/rtems/score/profiling.h index f5fa6cc241..a6ab283ae6 100644 --- a/cpukit/score/include/rtems/score/profiling.h +++ b/cpukit/score/include/rtems/score/profiling.h @@ -24,6 +24,7 @@ #define _RTEMS_SCORE_PROFILING #include <rtems/score/percpu.h> +#include <rtems/score/isrlock.h> #ifdef __cplusplus extern "C" { @@ -55,6 +56,26 @@ static inline void _Profiling_Thread_dispatch_disable( #endif } +static inline void _Profiling_Thread_dispatch_disable_critical( + Per_CPU_Control *cpu, + uint32_t previous_thread_dispatch_disable_level, + const ISR_lock_Context *lock_context +) +{ +#if defined( RTEMS_PROFILING ) + if ( previous_thread_dispatch_disable_level == 0 ) { + Per_CPU_Stats *stats = &cpu->Stats; + + stats->thread_dispatch_disabled_instant = lock_context->ISR_disable_instant; + ++stats->thread_dispatch_disabled_count; + } +#else + (void) cpu; + (void) previous_thread_dispatch_disable_level; + (void) lock_context; +#endif +} + static inline void _Profiling_Thread_dispatch_enable( Per_CPU_Control *cpu, uint32_t new_thread_dispatch_disable_level |