source: rtems/cpukit/score/include/rtems/score/profiling.h @ 993f5ac

4.115
Last change on this file since 993f5ac was 3380ee8, checked in by Sebastian Huber <sebastian.huber@…>, on 04/22/14 at 05:46:53

score: Use common names for per-CPU variables

Use "cpu" for an arbitrary Per_CPU_Control variable.

Use "cpu_self" for the Per_CPU_Control of the current processor.

Use "cpu_index" for an arbitrary processor index.

Use "cpu_index_self" for the processor index of the current processor.

Use "cpu_count" for the processor count obtained via
_SMP_Get_processor_count().

Use "cpu_max" for the processor maximum obtained by
rtems_configuration_get_maximum_processors().

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreProfiling
5 *
6 * @brief Profiling Support API
7 */
8
9/*
10 * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_PROFILING
24#define _RTEMS_SCORE_PROFILING
25
26#include <rtems/score/percpu.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
32/**
33 * @defgroup ScoreProfiling Profiling Support
34 *
35 * @brief Profiling support.
36 *
37 * @{
38 */
39
40static inline void _Profiling_Thread_dispatch_disable(
41  Per_CPU_Control *cpu,
42  uint32_t previous_thread_dispatch_disable_level
43)
44{
45#if defined( RTEMS_PROFILING )
46  if ( previous_thread_dispatch_disable_level == 0 ) {
47    Per_CPU_Stats *stats = &cpu->Stats;
48
49    stats->thread_dispatch_disabled_instant = _CPU_Counter_read();
50    ++stats->thread_dispatch_disabled_count;
51  }
52#else
53  (void) cpu;
54  (void) previous_thread_dispatch_disable_level;
55#endif
56}
57
58static inline void _Profiling_Thread_dispatch_enable(
59  Per_CPU_Control *cpu,
60  uint32_t new_thread_dispatch_disable_level
61)
62{
63#if defined( RTEMS_PROFILING )
64  if ( new_thread_dispatch_disable_level == 0 ) {
65    Per_CPU_Stats *stats = &cpu->Stats;
66    CPU_Counter_ticks now = _CPU_Counter_read();
67    CPU_Counter_ticks delta = _CPU_Counter_difference(
68      now,
69      stats->thread_dispatch_disabled_instant
70    );
71
72    stats->total_thread_dispatch_disabled_time += delta;
73
74    if ( stats->max_thread_dispatch_disabled_time < delta ) {
75      stats->max_thread_dispatch_disabled_time = delta;
76    }
77  }
78#else
79  (void) cpu;
80  (void) new_thread_dispatch_disable_level;
81#endif
82}
83
84static inline void _Profiling_Update_max_interrupt_delay(
85  Per_CPU_Control *cpu,
86  CPU_Counter_ticks interrupt_delay
87)
88{
89#if defined( RTEMS_PROFILING )
90  Per_CPU_Stats *stats = &cpu->Stats;
91
92  if ( stats->max_interrupt_delay < interrupt_delay ) {
93    stats->max_interrupt_delay = interrupt_delay;
94  }
95#else
96  (void) cpu;
97  (void) interrupt_delay;
98#endif
99}
100
101void _Profiling_Outer_most_interrupt_entry_and_exit(
102  Per_CPU_Control *cpu,
103  CPU_Counter_ticks interrupt_entry_instant,
104  CPU_Counter_ticks interrupt_exit_instant
105);
106
107/** @} */
108
109#ifdef __cplusplus
110}
111#endif /* __cplusplus */
112
113#endif /* _RTEMS_SCORE_PROFILING */
Note: See TracBrowser for help on using the repository browser.