diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-10 10:04:09 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-14 08:46:49 +0100 |
commit | f980561ee073a7f24f65ed572852fa96edfa1708 (patch) | |
tree | a2e62dd469acbe201388c9b8a3e0ebd9d7277e9f /cpukit/score/src/profilingisrentryexit.c | |
parent | sapi: Add SMP lock profiling app. level data (diff) | |
download | rtems-f980561ee073a7f24f65ed572852fa96edfa1708.tar.bz2 |
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.
Diffstat (limited to 'cpukit/score/src/profilingisrentryexit.c')
-rw-r--r-- | cpukit/score/src/profilingisrentryexit.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cpukit/score/src/profilingisrentryexit.c b/cpukit/score/src/profilingisrentryexit.c new file mode 100644 index 0000000000..3367e9800e --- /dev/null +++ b/cpukit/score/src/profilingisrentryexit.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include <rtems/score/profiling.h> + +void _Profiling_Outer_most_interrupt_entry_and_exit( + Per_CPU_Control *per_cpu, + CPU_Counter_ticks interrupt_entry_instant, + CPU_Counter_ticks interrupt_exit_instant +) +{ +#if defined( RTEMS_PROFILING ) + Per_CPU_Stats *stats = &per_cpu->Stats; + CPU_Counter_ticks 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; + } +#else + (void) per_cpu; + (void) interrupt_entry_instant; + (void) interrupt_exit_instant; +#endif +} |