From 40bfab099b5bf5a0dfddba7bc141e3cfe0638369 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 24 Dec 2021 19:25:02 -0500 Subject: [PATCH] [quantanal] show elapsed time --- src/poc/quantanal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/poc/quantanal.c b/src/poc/quantanal.c index 39c952092..94742d2dc 100644 --- a/src/poc/quantanal.c +++ b/src/poc/quantanal.c @@ -95,6 +95,8 @@ int main(int argc, char** argv){ } struct ncplane* stdn = notcurses_stdplane(nc); while(*++argv){ + struct timespec start; + clock_gettime(CLOCK_MONOTONIC, &start); ncplane_set_fg_rgb(stdn, 0xf9d71c); ncplane_printf(stdn, "analyzing %s...\n", *argv); notcurses_render(nc); @@ -161,8 +163,12 @@ int main(int argc, char** argv){ compare(ncv, quantncv, &geom, nc); ncvisual_destroy(quantncv); ncvisual_destroy(ncv); + struct timespec end; + clock_gettime(CLOCK_MONOTONIC, &end); + uint64_t t0 = timespec_to_ns(&start); + uint64_t t1 = timespec_to_ns(&end); ncplane_set_fg_rgb(stdn, 0x03ac13); - ncplane_printf(stdn, "done with %s.\n", *argv); + ncplane_printf(stdn, "done with %s in %.3gms.\n", *argv, (t1 - t0) / 1000000.0); ncplane_destroy(ncp); notcurses_render(nc); }