commit 0ff9ad99491a640cb4eed3ef7af102ec03df387b
parent d1bc402c294ce51a2fd6a3cd5b42e94085305c53
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 18 Mar 2021 10:20:08 +0100
Add init and compute time in extended output
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/green-main.c b/src/green-main.c
@@ -21,6 +21,7 @@
#include <rsys/rsys.h>
#include <rsys/mem_allocator.h>
#include <rsys/logger.h>
+#include <rsys/clock_time.h>
#include <stdlib.h>
#include <omp.h>
@@ -37,8 +38,13 @@ main
struct logger logger;
struct green green;
struct args args;
+ struct time init_start, tmp;
+ char buf[128];
+ const int flag = TIME_USEC | TIME_MSEC | TIME_SEC | TIME_MIN | TIME_HOUR ;
FILE* stream = NULL;
+ time_current(&init_start);
+
ERR(mem_init_proxy_allocator(&allocator, &mem_default_allocator));
allocator_initialized = 1;
@@ -114,6 +120,14 @@ main
}
} /* Implicit barrier */
if(res != RES_OK) goto error;
+ if(args.mode & MODE_EXTENTED_RESULTS) {
+ struct time init_end;
+ time_current(&init_end);
+ time_sub(&tmp, &init_end, &init_start);
+ time_dump(&tmp, flag, NULL, buf, sizeof(buf));
+ logger_print(&logger, LOG_OUTPUT, "Initialisation time = %s\n", buf);
+ }
+
if(args.mode & MODE_HTML_SUMMARY) {
ASSERT(args.info_filename);
stream = fopen(args.info_filename, "w");
@@ -128,7 +142,15 @@ main
}
if(args.mode & MODE_APPLY_GREEN) {
+ struct time compute_start, compute_end;
+ time_current(&compute_start);
ERR(green_compute(&green, args.command_filename));
+ if(args.mode & MODE_EXTENTED_RESULTS) {
+ time_current(&compute_end);
+ time_sub(&tmp, &compute_end, &compute_start);
+ time_dump(&tmp, flag, NULL, buf, sizeof(buf));
+ logger_print(&logger, LOG_OUTPUT, "Computation time = %s\n", buf);
+ }
green_print_result(&green, args.mode, stdout);
}