Skip to content

Commit

Permalink
remove tsc rounding for more accuracy (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
hilldani authored Aug 17, 2023
1 parent d82f25d commit 7c2e32e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/calibrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ static __inline__ uint64_t rdtsc_e(void)
}

unsigned Calibrate(void){
unsigned ROUNDUP=100;

uint64_t start=rdtsc_s();
sleep(1);
uint64_t end=rdtsc_e();

uint64_t clocks_mhz= (end-start)/1000000;
unsigned tsc_mhz= ((clocks_mhz/ROUNDUP) + ((clocks_mhz%ROUNDUP) != 0))*ROUNDUP;
unsigned tsc_mhz = clocks_mhz;
return tsc_mhz;

}

0 comments on commit 7c2e32e

Please sign in to comment.