From mboxrd@z Thu Jan 1 00:00:00 1970 From: J. William Campbell Date: Wed, 25 May 2011 09:50:28 -0700 Subject: [U-Boot] [RFC] Review of U-Boot timer API In-Reply-To: <20110525051723.09F99CF5DBF@gemini.denx.de> References: <4DD7B245.5000008@gmail.com> <201105240024.26511.vapier@gentoo.org> <4DDB42B1.2010206@emk-elektronik.de> <4DDBB29D.2050102@psyent.com> <20110524141950.2AB1CCF5DBF@gemini.denx.de> <4DDBE22D.6050806@gmail.com> <20110524191948.401CBCF5DBF@gemini.denx.de> <4DDC31EB.6040609@comcast.net> <20110525051723.09F99CF5DBF@gemini.denx.de> Message-ID: <4DDD3354.8030801@comcast.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 5/24/2011 10:17 PM, Wolfgang Denk wrote: > Dear "J. William Campbell", > > In message<4DDC31EB.6040609@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 counts the number of 100-nanosecond ticks since 1 January 1601 00:00:00 UT as reckoned in the 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 , a jiffy is the duration of one tick of the system timer 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 >