29 #define show_progress(total_time, progress_time) \
30 if (config->output != stdout) { \
31 fprintf(stdout, "Progress: %02lu %%\r", \
32 (progress_time * 100) / total_time); \
50 unsigned int rounds = 0;
51 unsigned int timed = 0;
54 printf(
"calibrating load of %lius, please wait...\n", load);
61 timed = (
unsigned int)(then - now);
65 for (i = 0; i < 4; i++) {
66 rounds = (
unsigned int)(load * estimated / timed);
67 dprintf(
"calibrating with %u rounds\n", rounds);
72 timed = (
unsigned int)(then - now);
76 printf(
"calibration done\n");
93 unsigned int _round, cycle;
95 long sleep_time = 0, load_time = 0;
96 long performance_time = 0, powersave_time = 0;
97 unsigned int calculations;
98 unsigned long total_time = 0, progress_time = 0;
100 sleep_time = config->
sleep;
101 load_time = config->
load;
104 for (_round = 1; _round <= config->
rounds; _round++)
105 total_time += _round * (config->
sleep + config->
load);
108 for (_round = 0; _round < config->
rounds; _round++) {
109 performance_time = 0
LL;
110 powersave_time = 0
LL;
125 printf(
"_round %i: doing %u cycles with %u calculations"
126 " for %lius\n", _round + 1, config->
cycles,
127 calculations, load_time);
130 _round, load_time, sleep_time);
133 printf(
"avarage: %lius, rps:%li\n",
134 load_time / calculations,
135 1000000 * calculations / load_time);
138 for (cycle = 0; cycle < config->
cycles; cycle++) {
143 performance_time += then - now - sleep_time;
145 printf(
"performance cycle took %lius, "
147 "load: %lius, rounds: %u\n",
148 (
long)(then - now), sleep_time,
149 load_time, calculations);
152 performance_time / config->
cycles);
154 progress_time += sleep_time + load_time;
164 for (cycle = 0; cycle < config->
cycles; cycle++) {
169 powersave_time += then - now - sleep_time;
171 printf(
"powersave cycle took %lius, "
173 "load: %lius, rounds: %u\n",
174 (
long)(then - now), sleep_time,
175 load_time, calculations);
178 progress_time += sleep_time + load_time;
182 powersave_time / config->
cycles);
184 performance_time * 100.0 / powersave_time);
188 printf(
"performance is at %.2f%%\n",
189 performance_time * 100.0 / powersave_time);