From d5423295988918f45b64d50cf0b9501a56b9aa36 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 18 May 2015 11:09:14 +0200 Subject: 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. --- cpukit/score/include/rtems/score/isrlock.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'cpukit/score/include/rtems/score/isrlock.h') diff --git a/cpukit/score/include/rtems/score/isrlock.h b/cpukit/score/include/rtems/score/isrlock.h index 5a68937b4d..994eb48ed0 100644 --- a/cpukit/score/include/rtems/score/isrlock.h +++ b/cpukit/score/include/rtems/score/isrlock.h @@ -68,6 +68,12 @@ typedef struct { #else ISR_Level isr_level; #endif +#if defined( RTEMS_PROFILING ) + /** + * @brief The last interrupt disable instant in CPU counter ticks. + */ + CPU_Counter_ticks ISR_disable_instant; +#endif } ISR_lock_Context; /** @@ -304,6 +310,13 @@ typedef struct { _ISR_Flash( ( _context )->isr_level ) #endif +#if defined( RTEMS_PROFILING ) + #define _ISR_lock_ISR_disable_profile( _context ) \ + ( _context )->ISR_disable_instant = _CPU_Counter_read(); +#else + #define _ISR_lock_ISR_disable_profile( _context ) +#endif + /** * @brief Disables interrupts and saves the previous interrupt state in the ISR * lock context. @@ -316,10 +329,16 @@ typedef struct { */ #if defined( RTEMS_SMP ) #define _ISR_lock_ISR_disable( _context ) \ - _ISR_Disable_without_giant( ( _context )->Lock_context.isr_level ) + do { \ + _ISR_Disable_without_giant( ( _context )->Lock_context.isr_level ); \ + _ISR_lock_ISR_disable_profile( _context ) \ + } while ( 0 ) #else #define _ISR_lock_ISR_disable( _context ) \ - _ISR_Disable( ( _context )->isr_level ) + do { \ + _ISR_Disable( ( _context )->isr_level ); \ + _ISR_lock_ISR_disable_profile( _context ) \ + } while ( 0 ) #endif /** -- cgit v1.2.3