Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PowerPC Time Base questions for Apple Computers



Martin,

At 12:13 PM -0400 10/28/04, Martin Knapp-Cordes wrote:
Hi,

I am a developer at The MathWorks working on improving the precision and
accuracy of our tic/toc functions in the MATLAB language. These functions
are used for measuring elapsed wallclock time for for one or more
operations in the MATLAB language.

I am planning to use the following API to do elapsed timing:

   mach_absolute_time()
   mach_timebase_info()

I have confirmed in my code so far that indeed on G5 desktops the update
frequency is about 33MHz, and appears to be fixed.

The frequency will always be fixed on a given system. sysctlbyname's hw.tbfrequency will give you the most accurate value known for the frequency.


I have been looking at the Timer Facilities (Chapter 8) in Book E:
Enhanced PowerPC Architecture published by IBM which is very
interesting.

Can anyone answer the following questions?

1. What clock mechanism (hardware/software) is driving the update of that
   register for Apple systems? What/who makes the decision that say
   on a G5 it is 33 MHz?


On all G5 systems, the Time Base is driven off of an external 33 MHz clock.
On older G4 system, the TB frequency is 1/4 of the bus frequency.
On newer G4 systems, where the bus frequency could change, it is driven from an external clock at 18.432 MHz.



2. Is the update frequency constant on all Apple systems, or can it
vary? We got burned recently on the Pentium M processor on Windows trying to
use the CPU cycle counter. It is clearly not constant for those
systems. Fortunately, Microsoft does provide an API that handles this
problem. Are we going to run into a problem on say some Apple
laptops where that interface above will not work?



Since all of the Kernel's timing is based on this clock, we require that it run at a fixed frequency.


Any help which be much appreciated.

Sincerely,
Martin Knapp-Cordes

---------------------------------------------------------------
|  Martin Knapp-Cordes               email@hidden     |
|  The MathWorks, Inc.               http://www.mathworks.com |
|  3 Apple Hill Drive                Natick, MA  01760        |
|  Tel: (508) 647-7321               Fax: (508) 647-7015      |
---------------------------------------------------------------

Josh _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >PowerPC Time Base questions for Apple Computers (From: Martin Knapp-Cordes <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.