git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6121 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
649decd105
commit
10a6a01271
|
@ -120,6 +120,18 @@ typedef struct ch_system {
|
|||
* @brief Virtual timers delta list header.
|
||||
*/
|
||||
virtual_timers_list_t vtlist;
|
||||
#if CH_CFG_USE_TM || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Measurement calibration value.
|
||||
*/
|
||||
rtcnt_t measurement_offset;
|
||||
#endif
|
||||
#if CH_DBG_STATISTICS || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Global kernel statistics.
|
||||
*/
|
||||
kernel_stats_t kernel_stats;
|
||||
#endif
|
||||
#if CH_DBG_ENABLED || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Pointer to the panic message.
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
/* Module exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Global kernel statistics.
|
||||
*/
|
||||
kernel_stats_t kernel_stats;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local types. */
|
||||
/*===========================================================================*/
|
||||
|
@ -67,19 +62,18 @@ kernel_stats_t kernel_stats;
|
|||
*/
|
||||
void _stats_init(void) {
|
||||
|
||||
kernel_stats.n_irq = 0;
|
||||
kernel_stats.n_ctxswc = 0;
|
||||
chTMObjectInit(&kernel_stats.m_crit_thd);
|
||||
chTMObjectInit(&kernel_stats.m_crit_isr);
|
||||
ch.kernel_stats.n_irq = 0;
|
||||
ch.kernel_stats.n_ctxswc = 0;
|
||||
chTMObjectInit(&ch.kernel_stats.m_crit_thd);
|
||||
chTMObjectInit(&ch.kernel_stats.m_crit_isr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Increases the IRQ counter.
|
||||
*/
|
||||
void _stats_increase_irq(void) {
|
||||
|
||||
kernel_stats.n_irq++;
|
||||
ch.kernel_stats.n_irq++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,7 +81,7 @@ void _stats_increase_irq(void) {
|
|||
*/
|
||||
void _stats_ctxswc(thread_t *ntp, thread_t *otp) {
|
||||
|
||||
kernel_stats.n_ctxswc++;
|
||||
ch.kernel_stats.n_ctxswc++;
|
||||
chTMChainMeasurementToX(&otp->p_stats, &ntp->p_stats);
|
||||
}
|
||||
|
||||
|
@ -96,7 +90,7 @@ void _stats_ctxswc(thread_t *ntp, thread_t *otp) {
|
|||
*/
|
||||
void _stats_start_measure_crit_thd(void) {
|
||||
|
||||
chTMStartMeasurementX(&kernel_stats.m_crit_thd);
|
||||
chTMStartMeasurementX(&ch.kernel_stats.m_crit_thd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +98,7 @@ void _stats_start_measure_crit_thd(void) {
|
|||
*/
|
||||
void _stats_stop_measure_crit_thd(void) {
|
||||
|
||||
chTMStopMeasurementX(&kernel_stats.m_crit_thd);
|
||||
chTMStopMeasurementX(&ch.kernel_stats.m_crit_thd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +106,7 @@ void _stats_stop_measure_crit_thd(void) {
|
|||
*/
|
||||
void _stats_start_measure_crit_isr(void) {
|
||||
|
||||
chTMStartMeasurementX(&kernel_stats.m_crit_isr);
|
||||
chTMStartMeasurementX(&ch.kernel_stats.m_crit_isr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,7 +114,7 @@ void _stats_start_measure_crit_isr(void) {
|
|||
*/
|
||||
void _stats_stop_measure_crit_isr(void) {
|
||||
|
||||
chTMStopMeasurementX(&kernel_stats.m_crit_isr);
|
||||
chTMStopMeasurementX(&ch.kernel_stats.m_crit_isr);
|
||||
}
|
||||
|
||||
#endif /* CH_DBG_STATISTICS */
|
||||
|
|
|
@ -47,11 +47,6 @@
|
|||
/* Module local variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Measurement calibration value.
|
||||
*/
|
||||
static rtcnt_t measurement_offset;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local functions. */
|
||||
/*===========================================================================*/
|
||||
|
@ -84,11 +79,11 @@ void _tm_init(void) {
|
|||
/* Time Measurement subsystem calibration, it does a null measurement
|
||||
and calculates the call overhead which is subtracted to real
|
||||
measurements.*/
|
||||
measurement_offset = 0;
|
||||
ch.measurement_offset = 0;
|
||||
chTMObjectInit(&tm);
|
||||
chTMStartMeasurementX(&tm);
|
||||
chTMStopMeasurementX(&tm);
|
||||
measurement_offset = tm.last;
|
||||
ch.measurement_offset = tm.last;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +125,7 @@ NOINLINE void chTMStartMeasurementX(time_measurement_t *tmp) {
|
|||
*/
|
||||
NOINLINE void chTMStopMeasurementX(time_measurement_t *tmp) {
|
||||
|
||||
tm_stop(tmp, chSysGetRealtimeCounterX(), measurement_offset);
|
||||
tm_stop(tmp, chSysGetRealtimeCounterX(), ch.measurement_offset);
|
||||
}
|
||||
|
||||
#endif /* CH_CFG_USE_TM */
|
||||
|
|
Loading…
Reference in New Issue