OSX上のWindowsのQueryPerformanceCounterと同等のものは何ですか?
質問
ライブラリをWindowsから* NIX(現在はOSX)に移植していますが、MicrosoftのQueryPerformanceCounterとQueryPerformanceFrequencyの代わりにどの機能を使用できますか?
解決
http://www.tin.org/ bin / man.cgi?section = 3 <!> amp; topic = clock_gettime (およびそこに記載されている他の機能) -それはPosixです! HPETが存在しない場合、より悪いカウンターにフォールバックします。 (ただし、問題はないはずです)
http://en.wikipedia.org/wiki/High_Precision_Event_Timer
解像度は約+10 MHzでなければなりません。
他のヒント
OSXでは、mach_absolute_time
およびmach_timebase_info
はWin32 QueryPerformance *関数に最もよく相当します。
http://developer.apple.com/library/をご覧ください。 mac /#qa / qa1398 / _index.html
彼はOS Xについて尋ねました。CoreAudioのこれらのAPIを使用してください:
AudioConvertHostTimeToNanos(AudioGetCurrentHostTime())
uclockを使用したか、アセンブラーを調べて RDTSC 。
G。
所属していません StackOverflow