void burn_cpu_abort(long long exec_usec, double exec_slope, char *abort) { long long i; for(i = 0; i < exec_usec; i++) { if(*abort) return; burn_cpu(1, exec_slope); } }
/* 02/22/2010. Attempt to determine processor clock rate even when speed step is in use. Keep running CPU-intensive task until determine maximum clock rate. */ double mhz(int verbose) { double maxval = 0.0; /* Temporary fix to specific machine */ double val = core_mhz(verbose); /* Revert back to original code */ return val; /* This was the new method */ while (val != maxval) { burn_cpu(); if (val > maxval) maxval = val; val = core_mhz(verbose); } return val; }
int main(int argc, char *argv[]) { int nmeas = 100; if (argc > 1) nmeas = atoi(argv[1]); int i; double max_mhz = 0.0; for (i = 0; i < nmeas; i++) { double mhz = get_mhz(); if (mhz > max_mhz) max_mhz = mhz; printf("%d\t%.2f\t%.2f\n", i, mhz, max_mhz); burn_cpu(); } return 0; }