Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Different behaviour of mach_absolute_time() on i386 / ppc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different behaviour of mach_absolute_time() on i386 / ppc




On Jul 24, 2006, at 4:13 AM, Dirk Stegemann wrote:

This works perfectly fine; as soon as the app launches, the values returned by 'getTimeInMilliseconds()' are very low (starting at zero), increasing during runtime of the app.

But on an Intel-Mac, the time stamps are increased differently than on a PPC Mac:
On Intel hardware, the time is increased constantly, independently from the programs current cpu usage.
On PPC hardware, the time is increased only when the cpu is used.


That is, when calling 'sleep()' or 'usleep()' on PPC hardware, the timer which is queried by 'mach_absolute_time()' appearently is stopped, whereas it continues to run on a Intel hardware.

Is this behavior documented somewhere? I've been counting on this to increment monotonically at a constant rate and not be affected by sleep or any other sort of behavior such as running multiple threads at once (on different processors) not affecting this.


Is there an explanation what is causing this difference in behaviour?

And if so, is there a way to get a monotonic clock with microsecond precision that isn't affected by anything like this?


--
Steve Checkoway


_______________________________________________ Do not post admin requests to the list. They will be ignored. PerfOptimization-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Different behaviour of mach_absolute_time() on i386 / ppc (From: Dirk Stegemann <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.