format output of timing demo

This commit is contained in:
Steffen Jaeckel 2018-02-02 10:23:17 +01:00
parent c69c3907c3
commit 82376cb19b

View File

@ -137,7 +137,7 @@ int main(void)
} while (++rr < 100000u); } while (++rr < 100000u);
printf("Adding\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Adding\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt); FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt);
FFLUSH(log); FFLUSH(log);
} }
FCLOSE(log); FCLOSE(log);
@ -159,7 +159,7 @@ int main(void)
printf("Subtracting\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Subtracting\t\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt); FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt);
FFLUSH(log); FFLUSH(log);
} }
FCLOSE(log); FCLOSE(log);
@ -194,7 +194,7 @@ int main(void)
} while (++rr < 100u); } while (++rr < 100u);
printf("Multiplying\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Multiplying\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%d %9" PRIu64 "\n", mp_count_bits(&a), tt); FPRINTF(log, "%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
FFLUSH(log); FFLUSH(log);
} }
FCLOSE(log); FCLOSE(log);
@ -214,7 +214,7 @@ int main(void)
} while (++rr < 100u); } while (++rr < 100u);
printf("Squaring\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Squaring\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%d %9" PRIu64 "\n", mp_count_bits(&a), tt); FPRINTF(log, "%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
FFLUSH(log); FFLUSH(log);
} }
FCLOSE(log); FCLOSE(log);
@ -291,7 +291,7 @@ int main(void)
printf("Exponentiating\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Exponentiating\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF((n < 4) ? logd : (n < 9) ? logc : (n < 16) ? logb : log, FPRINTF((n < 4) ? logd : (n < 9) ? logc : (n < 16) ? logb : log,
"%d %9" PRIu64 "\n", mp_count_bits(&a), tt); "%6d %9" PRIu64 "\n", mp_count_bits(&a), tt);
} }
} }
FCLOSE(log); FCLOSE(log);
@ -326,7 +326,7 @@ int main(void)
} }
printf("Inverting mod\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n", printf("Inverting mod\t%4d-bit => %9" PRIu64 "/sec, %9" PRIu64 " cycles\n",
mp_count_bits(&a), CLK_PER_SEC / tt, tt); mp_count_bits(&a), CLK_PER_SEC / tt, tt);
FPRINTF(log, "%d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt); FPRINTF(log, "%6d %9" PRIu64 "\n", cnt * DIGIT_BIT, tt);
} }
FCLOSE(log); FCLOSE(log);