diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-31 10:26:40 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-31 10:26:40 +0000 | 
| commit | 16044c7aeac671a4914749a387a6c526f0b2fdce (patch) | |
| tree | baf7912859ac2444e67873aa5113208ff23efe5b /os/kernel | |
| parent | 2c0ef77243a78e374c60b01dae1bd02057d7f12d (diff) | |
| download | ChibiOS-16044c7aeac671a4914749a387a6c526f0b2fdce.tar.gz ChibiOS-16044c7aeac671a4914749a387a6c526f0b2fdce.tar.bz2 ChibiOS-16044c7aeac671a4914749a387a6c526f0b2fdce.zip  | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6053 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel')
| -rw-r--r-- | os/kernel/include/chtm.h | 3 | ||||
| -rw-r--r-- | os/kernel/src/chtm.c | 6 | 
2 files changed, 6 insertions, 3 deletions
diff --git a/os/kernel/include/chtm.h b/os/kernel/include/chtm.h index b72bff8e6..93e24d48c 100644 --- a/os/kernel/include/chtm.h +++ b/os/kernel/include/chtm.h @@ -63,8 +63,9 @@  typedef struct {
    rtcnt_t               best;           /**< @brief Best measurement.       */
    rtcnt_t               worst;          /**< @brief Worst measurement.      */
 -  rtcnt_t               cumulative;     /**< @brief Cumulative measurement. */
    rtcnt_t               last;           /**< @brief Last measurement.       */
 +  ucnt_t                n;              /**< @brief Number of measurements. */
 +  rttime_t              cumulative;     /**< @brief Cumulative measurement. */
  } time_measurement_t;
  /*===========================================================================*/
 diff --git a/os/kernel/src/chtm.c b/os/kernel/src/chtm.c index 2bec0cc1c..e54bacbbf 100644 --- a/os/kernel/src/chtm.c +++ b/os/kernel/src/chtm.c @@ -60,8 +60,9 @@ static inline void tm_stop(time_measurement_t *tmp,                             rtcnt_t now,
                             rtcnt_t offset) {
 +  tmp->n++;
    tmp->last = now - tmp->last - offset;
 -  tmp->cumulative += tmp->last;
 +  tmp->cumulative += (rttime_t)tmp->last;
    if (tmp->last > tmp->worst)
      tmp->worst = tmp->last;
    else if (tmp->last < tmp->best)
 @@ -101,8 +102,9 @@ void chTMObjectInit(time_measurement_t *tmp) {    tmp->best       = (rtcnt_t)-1;
    tmp->worst      = (rtcnt_t)0;
 -  tmp->cumulative = (rtcnt_t)0;
    tmp->last       = (rtcnt_t)0;
 +  tmp->n          = (ucnt_t)0;
 +  tmp->cumulative = (rttime_t)0;
  }
  /**
  | 
