/* Print out progress if we log into a file */ #define show_progress(total_time, progress_time) \ if (config->output != stdout) { \
fprintf(stdout, "Progress: %02lu %%\r", \
(progress_time * 100) / total_time); \
fflush(stdout); \
}
/** * compute how many rounds of calculation we should do * to get the given load time * * @param load aimed load time in µs * * @retval rounds of calculation
**/
if (config->verbose)
printf("calibrating load of %lius, please wait...\n", load);
/* get the initial calculation time for a specific number of rounds */
now = get_time();
ROUNDS(estimated);
then = get_time();
timed = (unsignedint)(then - now);
/* approximation of the wanted load time by comparing with the
* initial calculation time */ for (i = 0; i < 4; i++) {
rounds = (unsignedint)(load * estimated / timed);
dprintf("calibrating with %u rounds\n", rounds);
now = get_time();
ROUNDS(rounds);
then = get_time();
/** * benchmark * generates a specific sleep an load time with the performance * governor and compares the used time for same calculations done * with the configured powersave governor * * @param config config values for the benchmark *
**/
/* set the cpufreq governor to "performance" which disables
* P-State switching. */ if (set_cpufreq_governor("performance", config->cpu) != 0) return;
/* calibrate the calculation time. the resulting calculation * _rounds should produce a load which matches the configured
* load time */
calculations = calculate_timespace(load_time, config);
if (config->verbose)
printf("_round %i: doing %u cycles with %u calculations" " for %lius\n", _round + 1, config->cycles,
calculations, load_time);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.