From e20c897d74e76d511b014340c5f3e90d9ca76c1c Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Wed, 29 Nov 2023 18:05:46 +0100 Subject: [PATCH] Added benchmark output --- src/ulas.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ulas.c b/src/ulas.c index 68a4e3c..d149d5c 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -4,6 +4,7 @@ #include #include #include +#include FILE *ulasin = NULL; FILE *ulasout = NULL; @@ -90,7 +91,14 @@ void ulas_fclose(FILE *f) { fclose(f); } +long long ulas_timeusec(void) { + struct timeval tv; + gettimeofday(&tv, NULL); + return 1000000 * tv.tv_sec + tv.tv_usec; +} + int ulas_main(struct ulas_config cfg) { + long long total_startusec = ulas_timeusec(); int rc = 0; ulas_init(cfg); if (cfg.output_path) { @@ -171,6 +179,12 @@ cleanup: ulas_free(); + long long total_endusec = ulas_timeusec(); + if (ulascfg.verbose) { + fprintf(ulaserr, "[Completed in %lld microseconds]\n", + total_endusec - total_startusec); + } + return rc; } -- 2.30.2