summaryrefslogtreecommitdiff
path: root/source/kit_test/bench.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-03-28 06:09:49 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-03-28 06:09:49 +0200
commitfa74a9d35eff204f688d89a1f795063e88c5fb2c (patch)
treef6d1069ecc1c93db08c80018e1eae3a1bb4bcd42 /source/kit_test/bench.c
parentad40a44208af594fed9e3e7e6bd01546740541f3 (diff)
downloadkit-fa74a9d35eff204f688d89a1f795063e88c5fb2c.zip
Print benchmark results in microseconds
Diffstat (limited to 'source/kit_test/bench.c')
-rw-r--r--source/kit_test/bench.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/kit_test/bench.c b/source/kit_test/bench.c
index 1dc2736..9d439c3 100644
--- a/source/kit_test/bench.c
+++ b/source/kit_test/bench.c
@@ -219,17 +219,17 @@ int kit_run_benchmarks(int argc, char **argv) {
printf("BENCHMARK");
printf("%*c", line_width - 9, ' ');
no_color || print_color(green);
- printf(" LOW ");
+ printf(" LOW ");
no_color || print_color(light);
printf("|");
no_color || print_color(blue);
- printf(" MEDIAN ");
+ printf(" MEDIAN ");
no_color || print_color(light);
printf("|");
no_color || print_color(yellow);
- printf(" HIGH ");
+ printf(" HIGH ");
no_color || print_color(light);
- printf(" in nanoseconds\n\n");
+ printf(" in microseconds\n\n");
/* Prepare cycles.
*/
@@ -325,11 +325,11 @@ int kit_run_benchmarks(int argc, char **argv) {
if (bench->repeats <= 0) {
no_color || print_color(yellow);
- printf(" 0 runs\n");
+ printf(" 0 runs\n");
success_count++;
} else if (bench_status == 0) {
no_color || print_color(red);
- printf(" FAIL\n");
+ printf(" FAIL\n");
status = 1;
} else {
int const repeats = bench->repeats;
@@ -347,15 +347,15 @@ int kit_run_benchmarks(int argc, char **argv) {
bench->duration_sorted_nsec[repeats - repeats / 20 - 1];
no_color || print_color(white);
- printf("%-8lld", (long long) floor);
+ printf("%-9g", (double) floor * 0.001);
no_color || print_color(light);
printf("| ");
no_color || print_color(white);
- printf("%-8lld", (long long) average);
+ printf("%-9g", (double) average * 0.001);
no_color || print_color(light);
printf("| ");
no_color || print_color(white);
- printf("%-8lld", (long long) roof);
+ printf("%-9g", (double) roof * 0.001);
no_color || print_color(light);
printf(" %d runs\n", repeats);
success_count++;