Browse Prior Art Database

Method for Increasing the Accuracy of a Software Clock

IP.com Disclosure Number: IPCOM000038367D
Original Publication Date: 1987-Jan-01
Included in the Prior Art Database: 2005-Jan-31
Document File: 1 page(s) / 11K

Publishing Venue

IBM

Related People

Floyd, RK: AUTHOR [+2]

Abstract

A method is described for increasing the accuracy of a finely grained software clock where the processor speed is limited relative to the granularity of the clock. A 'software clock' is a clock which is updated by software whenever a hardware counter produces an interrupt. Let c be the frequency in cycles/second that the hardware counter generates interrupts. The software clock (c1k1) is therefore updated every 1/c seconds. If the processor speed is limited and interrupts are inhibited for more than 1/c seconds, interrupts are lost and the clock falls behind.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 100% of the total text.

Page 1 of 1

Method for Increasing the Accuracy of a Software Clock

A method is described for increasing the accuracy of a finely grained software clock where the processor speed is limited relative to the granularity of the clock. A 'software clock' is a clock which is updated by software whenever a hardware counter produces an interrupt. Let c be the frequency in cycles/second that the hardware counter generates interrupts. The software clock (c1k1) is therefore updated every 1/c seconds. If the processor speed is limited and interrupts are inhibited for more than 1/c seconds, interrupts are lost and the clock falls behind. Assuming that the longest period of time that interrupts are inhibited (and thus clock 'ticks' are lost) is i*(1/c) or i/c seconds (i<<c), and that this occurs n times a second (n<<c), the clock loses n*i 'ticks' or (n*i)/c seconds for every second and renders the clock inaccurate. However, if we add another hardware counter which generates an interrupt greater than every i/c seconds and is a multiple of 1/c, or m/c (i<=m<=c), then this interrupt cannot be lost and it can be used to update a second software clock (c1k2) which in turn can set c1k1 by the formula, c1k1=c1k2*m. Now, c1k1 can never be in error by more than the smaller of n*i/c or m/c seconds.

1