[U-Boot] [RFC] Review of U-Boot timer API

J. William Campbell jwilliamcampbell at comcast.net
Wed May 25 18:50:28 CEST 2011


On 5/24/2011 10:17 PM, Wolfgang Denk wrote:
> Dear "J. William Campbell",
>
> In message<4DDC31EB.6040609 at comcast.net>  you wrote:
> ...
>> A tick is defined as the smallest increment of system time as measured by a
>> computer system (seehttp://en.wikipedia.org/wiki/System_time):
>>
>> 	System time is measured by a system clock, which is typically
>> 	implemented as a simple count of the number of ticks that have
>> 	transpired since some arbitrary starting date, called the
>> 	epoch.
>>
>> Unfortunately, this definition is obsolete, and has been for quite some
> Do you have any proof for such a claim?
Hi Wolfgang,
      Well, yes, in fact the same reference you used. Note that the 
statement "A tick is defined as the smallest increment of system time as 
measured by a computer system" is NOT found in 
http://en.wikipedia.org/wiki/System_time. That page is defining system 
time, and what we are discussing is the definition of a "tick". In fact, 
on the same wiki page you cite, there IS the statement "Windows NT 
<http://en.wikipedia.org/wiki/Windows_NT> counts the number of 
100-nanosecond ticks since 1 January 1601 00:00:00 UT as reckoned in the 
proleptic Gregorian calendar 
<http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar>, but returns 
the current time to the nearest millisecond". Here 100 nanosecond ticks 
clearly does not refer to any "hardware" 100 ns clock that exists on the 
pc. The 100 ns is a computed (dare I say virtual) "tick" value. The 
point here is that the definition of tick is yours, not wikipedia.org's. 
(Although we all are aware if it is wikipedia, it MUST be so).  Further, 
http://en.wikipedia.org/wiki/Jiffy_%28time%29#Use_in_computing contains 
the statement "In computing <http://en.wikipedia.org/wiki/Computing>, a 
jiffy is the duration of one tick of the system timer 
<http://en.wikipedia.org/wiki/System_time> interrupt 
<http://en.wikipedia.org/wiki/Interrupt>.". If a tick is the smallest 
increment of system time as measured by the computer system, the "of the 
system timer interrupt" part of the statement would be unnecessary. The 
fact it IS present indicates there are other kinds of ticks present in 
the universe.
     AFAIK, all timers "tick", and the definition of the tick rate is 
1/timer resolution. The concept of "timer ticks" and "clock ticks" has 
been around forever, and exists independent of System Time. For example, 
there may be a watchdog timer on a system that does not measure time at 
all, yet the watchdog still ticks. When you read a value from a timer 
that was not the "system timer", what do you call the value you read? I 
would call it ticks, and I bet just about everybody else would too.
     The only reason I feel this point matters at all is that when one 
refers to a routine called "get_ticks", it is not obvious to me which 
timer ticks are being referenced. You are saying that, by definition, it 
refers to the "system clock".  My feeling is that it is not obvious why 
that is so on a system that has many clocks. The name of the function or 
an argument to the function should, IMNSHO,  specify which timer ticks 
are being returned.

Best Regards,
Bill Campbell
>> years.  When computers had a single timer, the above definition worked,
>> but it no longer does, as many (most?) computers have several hardware
>> timers. A "tick" today is the time increment of any particular timer of
>> a computer system. So, when one writes a function called get_ticks on a
>> PPC, does one mean read the decrementer, or does one read the RTC or
>> does one read the TB register(s) A similar situation exists on the
>> Blackfin BF531/2/3, that has a preformance counter, a real-time clock,
>> and three programmable timers. Which tick do you want? For each u-boot
> Please re-read the definition.  At least as far as U-Boot and Linux
> are concerned, there is only a single clock source used to implement
> the _system_time_.  And I doubt that other OS do different.
>
>> implementation, we can pick one timer as the "master" timer, but it may
>> not be the one with the most rapid tick rate. It may be the one with the
>> most USEFUL tick rate for get_timer. If you take the above definition at
>> face value, only the fastest counter value has ticks, and all other
>> counters time increments are not ticks. If they are not ticks, what are
>> they?
> Clocks, timers?
>
>
> Best regards,
>
> Wolfgang Denk
>



More information about the U-Boot mailing list