From bc3c66027bb3993752855f996e75a98f990c1ef6 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 23 Jun 2009 13:10:04 +0200 Subject: [PATCH] Display total time --- communication_techniques/parsing.sh | 2 +- communication_techniques/src/main.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/communication_techniques/parsing.sh b/communication_techniques/parsing.sh index b20030f..f5f3b76 100644 --- a/communication_techniques/parsing.sh +++ b/communication_techniques/parsing.sh @@ -7,7 +7,7 @@ comList=`ls *.log | perl -ni -e '/-([^-]+)_comm/; $a{$1}=""; END { foreach ( sor cacheList=`ls *log | perl -ni -e '/cache_([^-]+)-/; $a{$1}=""; END { foreach ( sort keys %a ) {print "$_ "}}'` prodList=`ls *.log | perl -ni -e '/typeProd_([^-]+)-/; $a{$1}=""; END { foreach ( sort keys %a ) {print "$_ "}}'` -metriqueList="cache_hits cache_miss cycles" +metriqueList="cache_hits cache_miss cycles total_time" echo "set style data histogram" > multicores.gnuplot echo "set style histogram cluster gap 1" >> multicores.gnuplot diff --git a/communication_techniques/src/main.c b/communication_techniques/src/main.c index 614b112..8dbdad2 100644 --- a/communication_techniques/src/main.c +++ b/communication_techniques/src/main.c @@ -10,6 +10,7 @@ #include #include #include +#include /* Non standards includes */ #include @@ -177,6 +178,7 @@ int analyse_options(int argc, char *argv[]) void *producer(void *unused) { int i, j; + struct timeval tv1, tv2, tv_result; init_producer_thread(); if (shared) @@ -208,6 +210,7 @@ void *producer(void *unused) } } init_calc(INIT_CALC_ARG); + gettimeofday(&tv1, NULL); if (initialize_papi() != -1) { for(i = 0; i < nb_bufs_sent; i++) { @@ -217,6 +220,18 @@ void *producer(void *unused) } print_results(BUF_SIZE / sizeof(uintptr_t), nb_bufs_sent); } + gettimeofday(&tv2, NULL); + tv_result.tv_sec = tv2.tv_sec - tv1.tv_sec; + if (tv2.tv_usec < tv1.tv_usec) + { + tv_result.tv_usec = tv1.tv_usec - tv2.tv_usec; + tv_result.tv_sec--; + } + else + tv_result.tv_usec = tv2.tv_usec - tv1.tv_usec; + printf("total_time: %u.%6u / %u.%6u / %u.%6u\n", (unsigned) tv_result.tv_sec, (unsigned) tv_result.tv_usec, + (unsigned) tv_result.tv_sec, (unsigned) tv_result.tv_usec, (unsigned) tv_result.tv_sec, + (unsigned) tv_result.tv_usec); end_calc(); printf("[%p] Producer finished !\n", (void*) pthread_self()); /*