Naosecond high precision timing

xiaoxiao2021-03-06  68

Inline unsigned __int64 getcyclecount () {__ASM _EMIT 0x0F__ASM _EMIT 0X31}

// In the case where the counter is needed, you can call both GetCycleCount functions like using a normal Win32 API, compare the difference in two return values, like this: // unsigned long t; t = (unsigned long) getCyClet () ; // do something Time-Intensive ... t - = (unsigned long) getcyclecount ();

Under UNIX, I took it under FreeBSD, of course, can only be used in Pentium because INLINE long long getcyclecount () {__ASM ("RDTSC");} main () {long long count; Count = getCyClecount (); Sleep (1); Printf ("% d / n", getcyclecount () - count);}

转载请注明原文地址:https://www.9cbs.com/read-120387.html

New Post(0)