Welcome to the Linux Foundation Forum!

How to convert TSC cpu cycles into seconds ?

main()

{

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));

return tsc;

}

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training