How to convert TSC cpu cycles into seconds in C?
unsigned long long tsc_start, tsc_end;
tsc_start = get_tsc();
// execute some code
tsc_end = get_tsc();
printf("Total time for execution %llu cpu cycles", tsc_end - tsc_start);
printf("Total time in seconds "); // How to compute this ?
static unsigned long long get_tsc()
unsigned long long tsc;
asm volatile ("rdtsc" : "=A" (tsc));
maybe this is of help : http://www.unix.com/programming/81639-rdtsc-use-c.html
And please use code tags [code]your code here[/code] when posting code
|All times are GMT -5. The time now is 09:44 PM.|