From f980561ee073a7f24f65ed572852fa96edfa1708 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 10 Mar 2014 10:04:09 +0100 Subject: score: Add per-CPU profiling Add per-CPU profiling stats API. Implement the thread dispatch disable level profiling. The interrupt profiling must be implemented in CPU port specific parts (mostly assembler code). Add a support function _Profiling_Outer_most_interrupt_entry_and_exit() for this purpose. --- cpukit/score/include/rtems/score/threaddispatch.h | 37 ++++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'cpukit/score/include/rtems/score/threaddispatch.h') diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h index 5b25212de9..7e616d69f7 100644 --- a/cpukit/score/include/rtems/score/threaddispatch.h +++ b/cpukit/score/include/rtems/score/threaddispatch.h @@ -16,6 +16,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -140,12 +141,22 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void ) */ RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void) { - uint32_t level = _Thread_Dispatch_disable_level; + uint32_t disable_level = _Thread_Dispatch_disable_level; +#if defined( RTEMS_PROFILING ) + ISR_Level level; - ++level; - _Thread_Dispatch_disable_level = level; + _ISR_Disable( level ); + _Profiling_Thread_dispatch_disable( _Per_CPU_Get(), disable_level ); +#endif + + ++disable_level; + _Thread_Dispatch_disable_level = disable_level; + +#if defined( RTEMS_PROFILING ) + _ISR_Enable( level ); +#endif - return level; + return disable_level; } /** @@ -155,12 +166,22 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void ) */ RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void) { - uint32_t level = _Thread_Dispatch_disable_level; + uint32_t disable_level = _Thread_Dispatch_disable_level; +#if defined( RTEMS_PROFILING ) + ISR_Level level; - --level; - _Thread_Dispatch_disable_level = level; + _ISR_Disable( level ); +#endif + + --disable_level; + _Thread_Dispatch_disable_level = disable_level; + +#if defined( RTEMS_PROFILING ) + _Profiling_Thread_dispatch_enable( _Per_CPU_Get(), disable_level ); + _ISR_Enable( level ); +#endif - return level; + return disable_level; } #endif /* RTEMS_SMP */ -- cgit v1.2.3