aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/include')
-rw-r--r--os/kernel/include/chstats.h5
-rw-r--r--os/kernel/include/chsys.h2
-rw-r--r--os/kernel/include/chthreads.h3
3 files changed, 6 insertions, 4 deletions
diff --git a/os/kernel/include/chstats.h b/os/kernel/include/chstats.h
index d40117882..389fbf583 100644
--- a/os/kernel/include/chstats.h
+++ b/os/kernel/include/chstats.h
@@ -55,7 +55,6 @@
* @brief Type of a kernel statistics structure.
*/
typedef struct {
- time_measurement_t *current; /**< @brief Currently under measurement.*/
ucnt_t n_irq; /**< @brief Number of IRQs. */
ucnt_t n_ctxswc; /**< @brief Number of context switches. */
time_measurement_t m_crit_thd; /**< @brief Measurement of threads
@@ -81,7 +80,7 @@ extern "C" {
#endif
void _stats_init(void);
void _stats_increase_irq(void);
- void _stats_increase_ctxswc(void);
+ void _stats_ctxswc(thread_t *ntp, thread_t *otp);
void _stats_start_measure_crit_thd(void);
void _stats_stop_measure_crit_thd(void);
void _stats_start_measure_crit_isr(void);
@@ -98,7 +97,7 @@ extern "C" {
/* Stub functions for when the statistics module is disabled. */
#define _stats_increase_irq()
-#define _stats_increase_ctxswc()
+#define _stats_ctxswc(old, new)
#define _stats_start_measure_crit_thd()
#define _stats_stop_measure_crit_thd()
#define _stats_start_measure_crit_isr()
diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h
index bfb521d65..9eaf5d8e6 100644
--- a/os/kernel/include/chsys.h
+++ b/os/kernel/include/chsys.h
@@ -207,7 +207,7 @@
#define chSysSwitch(ntp, otp) { \
\
dbg_trace(otp); \
- _stats_increase_ctxswc(); \
+ _stats_ctxswc(ntp, otp); \
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
port_switch(ntp, otp); \
}
diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h
index a945f8d7d..66d000d7e 100644
--- a/os/kernel/include/chthreads.h
+++ b/os/kernel/include/chthreads.h
@@ -250,6 +250,9 @@ typedef struct thread {
*/
void *p_mpool;
#endif
+#if CH_DBG_STATISTICS || defined(__DOXYGEN__)
+ time_measurement_t p_stats;
+#endif
#if defined(CH_CFG_THREAD_EXTRA_FIELDS)
/* Extra fields defined in chconf.h.*/
CH_CFG_THREAD_EXTRA_FIELDS