該代碼受亂序執行等影響, 需要sync
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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); |
以上就是本文分享的全部內容了,希望小伙伴們能夠喜歡。