Skip to content

Commit

Permalink
Report CPU freq as measured by rdtsc
Browse files Browse the repository at this point in the history
It makes issues like rurban#241 more visible
  • Loading branch information
darkk committed Sep 7, 2024
1 parent 4337bbe commit c0d070a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SpeedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,20 @@ void BulkSpeedTest ( pfHash hash, uint32_t seed )

volatile double warmup_cycles = SpeedTest(hash,seed,trials,blocksize,0);

const double MHz2MiBps = (1000.0 * 1000.0) / (1024.0 * 1024.0);
for(int align = 7; align >= 0; align--)
{
double cycles = SpeedTest(hash,seed,trials,blocksize,align);

double bestbpc = double(blocksize)/cycles;

double bestbps = (bestbpc * 3000000000.0 / 1048576.0);
printf("Alignment %2d - %6.3f bytes/cycle - %7.2f MiB/sec @ 3 ghz\n",align,bestbpc,bestbps);
const unsigned cpuMHz = GetCpuFreqMHz();
double bestbps = (bestbpc * cpuMHz * MHz2MiBps);
printf("Alignment %2d - %6.3f bytes/cycle - %7.2f MiB/sec @ %u MHz\n",align,bestbpc,bestbps,cpuMHz);
sumbpc += bestbpc;
}
const unsigned cpuMHz = GetCpuFreqMHz();
sumbpc = sumbpc / 8.0;
printf("Average - %6.3f bytes/cycle - %7.2f MiB/sec @ 3 ghz\n",sumbpc,(sumbpc * 3000000000.0 / 1048576.0));
printf("Average - %6.3f bytes/cycle - %7.2f MiB/sec @ %u MHz\n",sumbpc,sumbpc*cpuMHz*MHz2MiBps,cpuMHz);
fflush(NULL);
}

Expand Down

0 comments on commit c0d070a

Please sign in to comment.