[RTEMS Project] #2271: Improved timestamp implementation

RTEMS trac trac at rtems.org
Thu Mar 19 08:49:03 UTC 2015


#2271: Improved timestamp implementation
-----------------------------+------------------------------
 Reporter:  sebastian.huber  |       Owner:  sebastian.huber
     Type:  enhancement      |      Status:  accepted
 Priority:  normal           |   Milestone:  4.11.1
Component:  cpukit           |     Version:  4.11
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------

Comment (by AlexKrEB):

 == Requirements ==

 ''' Introduction '''

 A central aspect of the performance tests was the determination of the
 minimum operating frequency the FreeBSD timecounters have to operate with.
 The timecounters are based on a ten-timehands mechanism that have to be
 updated continously. Time can be represented via the bintime, microtime
 and nanotime format. All formats are structs that consist of two
 variables, a time_t size for the seconds as well as a 64-bit variable for
 the fractional part of the bintime as well as long size for the
 microseconds and nanoseconds, respectively.
 The bintime of the current timehand is updated by adding the product
 (th->th_scale * tc_delta(th)) to the previous bintime value.

 ''' Problem and limiting factors '''

 The limiting factor of the binuptime operation is the possible overflow of
 the 64-bit sized fraction part of the bintime bt. Th->th_scale is
 determined by the frequency of the system itself and tc_delta(th) is
 growing with the offset count that is written into the variable since the
 last update. When one second has passed since the last update, the value
 is scaled by th->th_scale to the maximum 64-bit value which results in an
 overflow and in the process, miscalculations. Therefore, a timehand should
 never have timestamp values stored that are older than one second.

 ''' Consequence '''

 As the mechanism consists of a ring of ten timehands, each timehand should
 thus be updated every 1s/10 = 0.1s. Therefore, the minimum RTEMS system
 clock should at least be 10Hz so that timecounters can work properly. In
 order to have space to the absolute minimum, a '''minimum frequncy of
 20Hz''' should be chosen.

--
Ticket URL: <http://devel.rtems.org/ticket/2271#comment:9>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list