C语言计算代码执行所耗CPU时钟周期

#include "windows.h"

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);

 

转载于:https://www.cnblogs.com/felixr/p/5561974.html

你可能感兴趣的:(C语言计算代码执行所耗CPU时钟周期)