diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-13 11:39:43 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-14 14:20:30 +0200 |
commit | c34bb0dcfa8ba1294cd5182349e1ddbe34f81bf4 (patch) | |
tree | 249469ef52fd9829a59ca914322805c351267da1 /cpukit/score/src/coretodset.c | |
parent | score: New structure TOD_Control (diff) | |
download | rtems-c34bb0dcfa8ba1294cd5182349e1ddbe34f81bf4.tar.bz2 |
score: Fix performance issue for 64-bit timestamps
The 64-bit timestamps were introduced to simplify the timestamp
calculations. This works well since nearly all operations are
additions. The previous _TOD_Tickle_ticks() implementation had a
serious performance regression in case of 64-bit timestamps due to the
usage of two 64-bit divisions which are quite expensive on some
architectures.
A new field seconds_trigger in TOD_Control is introduced to trigger the
_Watchdog_Tickle_seconds() in _TOD_Tickle_ticks(). This avoids the
64-bit divisions completely and only 32-bit additions are used.
Diffstat (limited to 'cpukit/score/src/coretodset.c')
-rw-r--r-- | cpukit/score/src/coretodset.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c index 9708ef9477..8b0928af60 100644 --- a/cpukit/score/src/coretodset.c +++ b/cpukit/score/src/coretodset.c @@ -25,6 +25,7 @@ void _TOD_Set_with_timestamp( const Timestamp_Control *tod ) { + uint32_t nanoseconds = _Timestamp_Get_nanoseconds( tod ); Watchdog_Interval seconds_next = _Timestamp_Get_seconds( tod ); Watchdog_Interval seconds_now; @@ -39,6 +40,7 @@ void _TOD_Set_with_timestamp( _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, seconds_next - seconds_now ); _TOD.now = *tod; + _TOD.seconds_trigger = nanoseconds; _TOD.is_set = true; _TOD_Activate(); |