[英]What's the equivalent of Windows' QueryPerformanceCounter on OSX?
我正在将一个库从Windows移植到* NIX(目前是OSX),现在有人可以使用什么功能代替Microsoft的QueryPerformanceCounter和QueryPerformanceFrequency?
On OSX mach_absolute_time
and mach_timebase_info
are the best equivalents to Win32 QueryPerformance* functions. 在OSX上,
mach_absolute_time
和mach_timebase_info
是Win32 QueryPerformance *函数的最佳等价物。
See http://developer.apple.com/library/mac/#qa/qa1398/_index.html 请参阅http://developer.apple.com/library/mac/#qa/qa1398/_index.html
http://www.tin.org/bin/man.cgi?section=3&topic=clock_gettime (and the other functions mentioned there) - it's Posix! http://www.tin.org/bin/man.cgi?section=3&topic=clock_gettime (以及那里提到的其他功能) - 它是Posix! Will fall back to worse counters if HPET is not existent.
如果HPET不存在,将会回落到更糟糕的计数器。 (shouldn't be a problem though)
(虽然不应该是一个问题)
http://en.wikipedia.org/wiki/High_Precision_Event_Timer http://en.wikipedia.org/wiki/High_Precision_Event_Timer
Resolution should be about +10Mhz. 分辨率应约为+ 10Mhz。
他询问了OS X.使用CoreAudio中的这些API:
AudioConvertHostTimeToNanos(AudioGetCurrentHostTime())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.