- 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);
- //该片段来自于http://www.codesnippet.cn/detail/2204201512379.html
来源: http://www.codesnippet.cn/detail/2204201512379.html