summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/isrlock.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-18 11:09:14 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 15:14:33 +0200
commitd5423295988918f45b64d50cf0b9501a56b9aa36 (patch)
treede09916f70f4f10b47cf080e7149c1cef2c47198 /cpukit/score/include/rtems/score/isrlock.h
parentscore: Replace _Thread_Delay_ended() (diff)
downloadrtems-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 '')
-rw-r--r--cpukit/score/include/rtems/score/isrlock.h23
1 files changed, 21 insertions, 2 deletions
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
/**