source: rtems/cpukit/score/src/profilingisrentryexit.c @ 1c2d178

5
Last change on this file since 1c2d178 was 4b5ff47, checked in by Sebastian Huber <sebastian.huber@…>, on 11/23/16 at 15:15:13

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.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <rtems/score/profiling.h>
20#include <rtems/score/assert.h>
21
22void _Profiling_Outer_most_interrupt_entry_and_exit(
23  Per_CPU_Control *cpu,
24  CPU_Counter_ticks interrupt_entry_instant,
25  CPU_Counter_ticks interrupt_exit_instant
26)
27{
28#if defined(RTEMS_PROFILING)
29  Per_CPU_Stats     *stats;
30  CPU_Counter_ticks  delta;
31
32  _Assert( cpu->isr_nest_level == 1 );
33
34  stats = &cpu->Stats;
35  delta = _CPU_Counter_difference(
36    interrupt_exit_instant,
37    interrupt_entry_instant
38  );
39  ++stats->interrupt_count;
40  stats->total_interrupt_time += delta;
41
42  if ( stats->max_interrupt_time < delta ) {
43    stats->max_interrupt_time = delta;
44  }
45
46  if ( cpu->thread_dispatch_disable_level == 1 ) {
47    stats->thread_dispatch_disabled_instant = interrupt_entry_instant;
48  }
49#else
50  (void) cpu;
51  (void) interrupt_entry_instant;
52  (void) interrupt_exit_instant;
53#endif
54}
Note: See TracBrowser for help on using the repository browser.