git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6056 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
16044c7aea
commit
ceea042aaf
|
@ -55,7 +55,6 @@
|
||||||
* @brief Type of a kernel statistics structure.
|
* @brief Type of a kernel statistics structure.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
time_measurement_t *current; /**< @brief Currently under measurement.*/
|
|
||||||
ucnt_t n_irq; /**< @brief Number of IRQs. */
|
ucnt_t n_irq; /**< @brief Number of IRQs. */
|
||||||
ucnt_t n_ctxswc; /**< @brief Number of context switches. */
|
ucnt_t n_ctxswc; /**< @brief Number of context switches. */
|
||||||
time_measurement_t m_crit_thd; /**< @brief Measurement of threads
|
time_measurement_t m_crit_thd; /**< @brief Measurement of threads
|
||||||
|
@ -81,7 +80,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void _stats_init(void);
|
void _stats_init(void);
|
||||||
void _stats_increase_irq(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_start_measure_crit_thd(void);
|
||||||
void _stats_stop_measure_crit_thd(void);
|
void _stats_stop_measure_crit_thd(void);
|
||||||
void _stats_start_measure_crit_isr(void);
|
void _stats_start_measure_crit_isr(void);
|
||||||
|
@ -98,7 +97,7 @@ extern "C" {
|
||||||
|
|
||||||
/* Stub functions for when the statistics module is disabled. */
|
/* Stub functions for when the statistics module is disabled. */
|
||||||
#define _stats_increase_irq()
|
#define _stats_increase_irq()
|
||||||
#define _stats_increase_ctxswc()
|
#define _stats_ctxswc(old, new)
|
||||||
#define _stats_start_measure_crit_thd()
|
#define _stats_start_measure_crit_thd()
|
||||||
#define _stats_stop_measure_crit_thd()
|
#define _stats_stop_measure_crit_thd()
|
||||||
#define _stats_start_measure_crit_isr()
|
#define _stats_start_measure_crit_isr()
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
#define chSysSwitch(ntp, otp) { \
|
#define chSysSwitch(ntp, otp) { \
|
||||||
\
|
\
|
||||||
dbg_trace(otp); \
|
dbg_trace(otp); \
|
||||||
_stats_increase_ctxswc(); \
|
_stats_ctxswc(ntp, otp); \
|
||||||
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
|
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
|
||||||
port_switch(ntp, otp); \
|
port_switch(ntp, otp); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,9 @@ typedef struct thread {
|
||||||
*/
|
*/
|
||||||
void *p_mpool;
|
void *p_mpool;
|
||||||
#endif
|
#endif
|
||||||
|
#if CH_DBG_STATISTICS || defined(__DOXYGEN__)
|
||||||
|
time_measurement_t p_stats;
|
||||||
|
#endif
|
||||||
#if defined(CH_CFG_THREAD_EXTRA_FIELDS)
|
#if defined(CH_CFG_THREAD_EXTRA_FIELDS)
|
||||||
/* Extra fields defined in chconf.h.*/
|
/* Extra fields defined in chconf.h.*/
|
||||||
CH_CFG_THREAD_EXTRA_FIELDS
|
CH_CFG_THREAD_EXTRA_FIELDS
|
||||||
|
|
|
@ -83,11 +83,12 @@ void _stats_increase_irq(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Increases the context switch counter.
|
* @brief Updates context switch related statistics.
|
||||||
*/
|
*/
|
||||||
void _stats_increase_ctxswc(void) {
|
void _stats_ctxswc(thread_t *ntp, thread_t *otp) {
|
||||||
|
|
||||||
kernel_stats.n_ctxswc++;
|
kernel_stats.n_ctxswc++;
|
||||||
|
chTMChainMeasurementToX(&otp->p_stats, &ntp->p_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -124,6 +124,9 @@ thread_t *_thread_init(thread_t *tp, tprio_t prio) {
|
||||||
#if CH_DBG_ENABLE_STACK_CHECK
|
#if CH_DBG_ENABLE_STACK_CHECK
|
||||||
tp->p_stklimit = (stkalign_t *)(tp + 1);
|
tp->p_stklimit = (stkalign_t *)(tp + 1);
|
||||||
#endif
|
#endif
|
||||||
|
#if CH_DBG_STATISTICS || defined(__DOXYGEN__)
|
||||||
|
chTMStartMeasurementX(&tp->p_stats);
|
||||||
|
#endif
|
||||||
#if defined(CH_CFG_THREAD_INIT_HOOK)
|
#if defined(CH_CFG_THREAD_INIT_HOOK)
|
||||||
CH_CFG_THREAD_INIT_HOOK(tp);
|
CH_CFG_THREAD_INIT_HOOK(tp);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue