From 9cd24294b8b5c32af4f64762eb99868b1a5c7b75 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 30 Jul 2013 09:19:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6045 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chtm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'os/kernel/src') diff --git a/os/kernel/src/chtm.c b/os/kernel/src/chtm.c index 474177093..2bec0cc1c 100644 --- a/os/kernel/src/chtm.c +++ b/os/kernel/src/chtm.c @@ -56,9 +56,11 @@ static rtcnt_t measurement_offset; /* Module local functions. */ /*===========================================================================*/ -static inline void tm_stop(time_measurement_t *tmp, rtcnt_t now) { +static inline void tm_stop(time_measurement_t *tmp, + rtcnt_t now, + rtcnt_t offset) { - tmp->last = now - tmp->last - measurement_offset; + tmp->last = now - tmp->last - offset; tmp->cumulative += tmp->last; if (tmp->last > tmp->worst) tmp->worst = tmp->last; @@ -126,7 +128,7 @@ NOINLINE void chTMStartMeasurementX(time_measurement_t *tmp) { */ NOINLINE void chTMStopMeasurementX(time_measurement_t *tmp) { - tm_stop(tmp, chSysGetRealtimeCounterX()); + tm_stop(tmp, chSysGetRealtimeCounterX(), measurement_offset); } #endif /* CH_CFG_USE_TM */ @@ -150,7 +152,7 @@ NOINLINE void chTMChainMeasurementToX(time_measurement_t *tmp1, tmp2->last = chSysGetRealtimeCounterX(); /* Stops previous measurement using the same time stamp.*/ - tm_stop(tmp1, tmp2->last); + tm_stop(tmp1, tmp2->last, 0); } /** @} */ -- cgit v1.2.3