add time
This commit is contained in:
parent
4f03fc2d5b
commit
0637fcdba1
5
main.c
5
main.c
@ -4,6 +4,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <papi.h>
|
||||||
|
|
||||||
#define MASTER 0
|
#define MASTER 0
|
||||||
#define DEFAULT_TAG 17
|
#define DEFAULT_TAG 17
|
||||||
@ -56,6 +57,7 @@ int main() {
|
|||||||
int lps[pattern_len];
|
int lps[pattern_len];
|
||||||
create_lps(pattern, pattern_len, lps);
|
create_lps(pattern, pattern_len, lps);
|
||||||
|
|
||||||
|
long_long start_time = PAPI_get_real_usec();
|
||||||
// search for matches
|
// search for matches
|
||||||
int match_number = 0;
|
int match_number = 0;
|
||||||
int residue;
|
int residue;
|
||||||
@ -69,12 +71,15 @@ int main() {
|
|||||||
|
|
||||||
collect_results(&match_number, matches);
|
collect_results(&match_number, matches);
|
||||||
|
|
||||||
|
long_long end_time = PAPI_get_real_usec();
|
||||||
|
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
|
|
||||||
if (rank == MASTER) {
|
if (rank == MASTER) {
|
||||||
printf("total matches: %d\n", total_match_number);
|
printf("total matches: %d\n", total_match_number);
|
||||||
printf("matches index: ");
|
printf("matches index: ");
|
||||||
print_array(total_matches, total_match_number);
|
print_array(total_matches, total_match_number);
|
||||||
|
printf("elapsed: %d\n", end_time - start_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user