【tsc】
time stamp counter
【性能】
大概只要chrono接口的1/6时延
【测试程序】
#include <x86intrin.h> #include <chrono> #include <cstdio> using namespace std::chrono; int main(){ u_int64_t begin = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); for(int i=0;i<100000;i++){ u_int64_t a = __rdtsc(); // u_int64_t a = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); } u_int64_t end = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); printf("time_elapsed=%llu\n", end - begin); return 0; }
标签:count,clock,since,epoch,时间,time,rdtsc,now From: https://www.cnblogs.com/jiangshifu/p/18014479