1 #include "libcflat.h" 2 #include "processor.h" 3 4 void test_wrtsc(u64 t1) 5 { 6 u64 t2; 7 8 wrtsc(t1); 9 t2 = rdtsc(); 10 printf("rdtsc after wrtsc(%lld): %lld\n", t1, t2); 11 } 12 13 int main() 14 { 15 u64 t1, t2; 16 17 t1 = rdtsc(); 18 t2 = rdtsc(); 19 printf("rdtsc latency %lld\n", (unsigned)(t2 - t1)); 20 21 test_wrtsc(0); 22 test_wrtsc(100000000000ull); 23 return 0; 24 } 25