欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C語言計(jì)算代碼執(zhí)行所耗CPU時(shí)鐘周期

 更新時(shí)間:2015年03月23日 09:36:53   投稿:hebedich  
本文給大家介紹的是使用C語言來計(jì)算代碼執(zhí)行所耗CPU時(shí)鐘周期的代碼,非常的簡單實(shí)用,不過要依托于sync,有需要的小伙伴自己參考下吧。

該代碼受亂序執(zhí)行等影響, 需要sync

LARGE_INTEGER _start = { 0 }, _end = { 0 };
__asm{
  rdtsc
  mov dword ptr [_start.LowPart], eax
  mov dword ptr[_start.HighPart], edx
}
 
//your code here
 
__asm{
  rdtsc
  mov dword ptr [_end.LowPart], eax
  mov dword ptr[_end.HighPart], edx
}
 
long interval = static_cast<long>(_end.QuadPart - _start.QuadPart);

以上就是本文分享的全部內(nèi)容了,希望小伙伴們能夠喜歡。

相關(guān)文章

最新評論