From 0637fcdba14c37242e1613cc203545361dccfaa6 Mon Sep 17 00:00:00 2001 From: norangebit Date: Fri, 26 Mar 2021 17:37:13 +0100 Subject: [PATCH] add time --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index b672ba2..c98249c 100644 --- a/main.c +++ b/main.c @@ -4,6 +4,7 @@ #include "util.h" #include #include +#include #define MASTER 0 #define DEFAULT_TAG 17 @@ -56,6 +57,7 @@ int main() { int lps[pattern_len]; create_lps(pattern, pattern_len, lps); + long_long start_time = PAPI_get_real_usec(); // search for matches int match_number = 0; int residue; @@ -69,12 +71,15 @@ int main() { collect_results(&match_number, matches); + long_long end_time = PAPI_get_real_usec(); + MPI_Finalize(); if (rank == MASTER) { printf("total matches: %d\n", total_match_number); printf("matches index: "); print_array(total_matches, total_match_number); + printf("elapsed: %d\n", end_time - start_time); } }