diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-23 16:15:13 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-24 08:46:20 +0100 |
commit | 4b5ff47d159872ef9e1096713fd68367f4640576 (patch) | |
tree | 1d45361562faaac01ec00dcc1768fe4814a97252 /cpukit | |
parent | powerpc: Fix interrupt profiling for e6500 (diff) | |
download | rtems-4b5ff47d159872ef9e1096713fd68367f4640576.tar.bz2 |
score: Fix interrupt profiling
Callers of _Thread_Do_dispatch() must have a valid
Per_CPU_Control::Stats::thread_dispatch_disabled_instant.
Call _Profiling_Outer_most_interrupt_entry_and_exit() with the interrupt
stack to not exceed Per_CPU_Control::Interrupt_frame.
Update #2751.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/score/include/rtems/score/profiling.h | 6 | ||||
-rw-r--r-- | cpukit/score/src/profilingisrentryexit.c | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/cpukit/score/include/rtems/score/profiling.h b/cpukit/score/include/rtems/score/profiling.h index a6ab283ae6..6ba5d2987f 100644 --- a/cpukit/score/include/rtems/score/profiling.h +++ b/cpukit/score/include/rtems/score/profiling.h @@ -119,6 +119,12 @@ static inline void _Profiling_Update_max_interrupt_delay( #endif } +/** + * @brief Updates the interrupt profiling statistics. + * + * Must be called with the interrupt stack and before the thread dispatch + * disable level is decremented. + */ void _Profiling_Outer_most_interrupt_entry_and_exit( Per_CPU_Control *cpu, CPU_Counter_ticks interrupt_entry_instant, diff --git a/cpukit/score/src/profilingisrentryexit.c b/cpukit/score/src/profilingisrentryexit.c index c7842a5dcb..98df154d72 100644 --- a/cpukit/score/src/profilingisrentryexit.c +++ b/cpukit/score/src/profilingisrentryexit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -17,6 +17,7 @@ #endif #include <rtems/score/profiling.h> +#include <rtems/score/assert.h> void _Profiling_Outer_most_interrupt_entry_and_exit( Per_CPU_Control *cpu, @@ -24,19 +25,27 @@ void _Profiling_Outer_most_interrupt_entry_and_exit( CPU_Counter_ticks interrupt_exit_instant ) { -#if defined( RTEMS_PROFILING ) - Per_CPU_Stats *stats = &cpu->Stats; - CPU_Counter_ticks delta = _CPU_Counter_difference( +#if defined(RTEMS_PROFILING) + Per_CPU_Stats *stats; + CPU_Counter_ticks delta; + + _Assert( cpu->isr_nest_level == 1 ); + + stats = &cpu->Stats; + delta = _CPU_Counter_difference( interrupt_exit_instant, interrupt_entry_instant ); - ++stats->interrupt_count; stats->total_interrupt_time += delta; if ( stats->max_interrupt_time < delta ) { stats->max_interrupt_time = delta; } + + if ( cpu->thread_dispatch_disable_level == 1 ) { + stats->thread_dispatch_disabled_instant = interrupt_entry_instant; + } #else (void) cpu; (void) interrupt_entry_instant; |