3 回答
TA贡献1871条经验 获得超13个赞
__rdtsc()
#ifdef _WIN32#include <intrin.h>#else#include <x86intrin.h>#endif
#include <stdint.h>// Windows#ifdef _WIN32#include <intrin.h>uint64_t rdtsc(){ return __rdtsc();}// Linux/GCC#elseuint64_t rdtsc(){ unsigned int lo,hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); return ((uint64_t)hi << 32) | lo;}#endif
TA贡献1856条经验 获得超11个赞
rdtsc
rdtsc
QueryPerformanceCounter
.
rdtsc
xor eax, eax cpuid xor eax, eax cpuid xor eax, eax cpuid rdtsc ; save eax, edx ; code you're going to time goes here xor eax, eax cpuid rdtsc
rdtsc
- 3 回答
- 0 关注
- 868 浏览
添加回答
举报