aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/include')
-rw-r--r--os/kernel/include/chstats.h56
-rw-r--r--os/kernel/include/chsys.h38
-rw-r--r--os/kernel/include/chtm.h2
3 files changed, 24 insertions, 72 deletions
diff --git a/os/kernel/include/chstats.h b/os/kernel/include/chstats.h
index a62eba0cc..d40117882 100644
--- a/os/kernel/include/chstats.h
+++ b/os/kernel/include/chstats.h
@@ -62,60 +62,12 @@ typedef struct {
critical zones duration. */
time_measurement_t m_crit_isr; /**< @brief Measurement of ISRs critical
zones duration. */
- time_measurement_t m_isr; /**< @brief Measurement of ISRs total
- duration. */
} kernel_stats_t;
/*===========================================================================*/
/* Module macros. */
/*===========================================================================*/
-/**
- * @brief Increases the IRQ counter.
- */
-#define _stats_increase_irq() kernel_stats.n_irq++
-
-/**
- * @brief Increases the context switch counter.
- */
-#define _stats_increase_ctxswc() kernel_stats.n_ctxswc++
-
-/**
- * @brief Starts the measurement of a thread critical zone.
- */
-#define _stats_start_measure_crit_thd() \
- chTMStartMeasurementX(&kernel_stats.m_crit_thd)
-
-/**
- * @brief Stops the measurement of a thread critical zone.
- */
-#define _stats_stop_measure_crit_thd() \
- chTMStopMeasurementX(&kernel_stats.m_crit_thd)
-
-/**
- * @brief Starts the measurement of an ISR critical zone.
- */
-#define _stats_start_measure_crit_isr() \
- chTMStartMeasurementX(&kernel_stats.m_crit_isr)
-
-/**
- * @brief Stops the measurement of an ISR critical zone.
- */
-#define _stats_stop_measure_crit_isr() \
- chTMStopMeasurementX(&kernel_stats.m_crit_isr)
-
-/**
- * @brief Starts the measurement of an ISR duration.
- */
-#define _stats_start_measure_isr() \
- chTMStartMeasurementX(&kernel_stats.m_crit_isr)
-
-/**
- * @brief Stops the measurement of an ISR duration.
- */
-#define _stats_stop_measure_isr() \
- chTMStopMeasurementX(&kernel_stats.m_crit_isr)
-
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -128,6 +80,12 @@ extern kernel_stats_t kernel_stats;
extern "C" {
#endif
void _stats_init(void);
+ void _stats_increase_irq(void);
+ void _stats_increase_ctxswc(void);
+ void _stats_start_measure_crit_thd(void);
+ void _stats_stop_measure_crit_thd(void);
+ void _stats_start_measure_crit_isr(void);
+ void _stats_stop_measure_crit_isr(void);
#ifdef __cplusplus
}
#endif
@@ -145,8 +103,6 @@ extern "C" {
#define _stats_stop_measure_crit_thd()
#define _stats_start_measure_crit_isr()
#define _stats_stop_measure_crit_isr()
-#define _stats_start_measure_isr()
-#define _stats_stop_measure_isr()
#endif /* !CH_DBG_STATISTICS */
diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h
index 9663e85ac..bfb521d65 100644
--- a/os/kernel/include/chsys.h
+++ b/os/kernel/include/chsys.h
@@ -61,7 +61,6 @@
*/
#define CH_IRQ_PROLOGUE() \
PORT_IRQ_PROLOGUE(); \
- _stats_start_measure_isr(); \
_stats_increase_irq(); \
dbg_check_enter_isr()
@@ -75,7 +74,6 @@
*/
#define CH_IRQ_EPILOGUE() \
dbg_check_leave_isr(); \
- _stats_stop_measure_isr(); \
PORT_IRQ_EPILOGUE()
/**
@@ -196,6 +194,24 @@
#define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value()
#endif
+/**
+ * @brief Performs a context switch.
+ * @note Not a user function, it is meant to be invoked by the scheduler
+ * itself or from within the port layer.
+ *
+ * @param[in] ntp the thread to be switched in
+ * @param[in] otp the thread to be switched out
+ *
+ * @special
+ */
+#define chSysSwitch(ntp, otp) { \
+ \
+ dbg_trace(otp); \
+ _stats_increase_ctxswc(); \
+ CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
+ port_switch(ntp, otp); \
+}
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -221,24 +237,6 @@ extern "C" {
/*===========================================================================*/
/**
- * @brief Performs a context switch.
- * @note Not a user function, it is meant to be invoked by the scheduler
- * itself or from within the port layer.
- *
- * @param[in] ntp the thread to be switched in
- * @param[in] otp the thread to be switched out
- *
- * @special
- */
-static inline void chSysSwitch(thread_t *ntp, thread_t *otp) {
-
- dbg_trace(otp);
- _stats_increase_ctxswc();
- CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp);
- port_switch(ntp, otp);
-}
-
-/**
* @brief Raises the system interrupt priority mask to the maximum level.
* @details All the maskable interrupt sources are disabled regardless their
* hardware priority.
diff --git a/os/kernel/include/chtm.h b/os/kernel/include/chtm.h
index 8d8d021fd..b72bff8e6 100644
--- a/os/kernel/include/chtm.h
+++ b/os/kernel/include/chtm.h
@@ -31,8 +31,6 @@
#if CH_CFG_USE_TM || defined(__DOXYGEN__)
-#define port_rt_get_counter_value() 0
-
/*===========================================================================*/
/* Module constants. */
/*===========================================================================*/