Display total time

This commit is contained in:
Thomas Preud'homme 2009-06-23 13:10:04 +02:00 committed by Thomas Preud'homme
parent f3749cb25d
commit bc3c66027b
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -10,6 +10,7 @@
#include <sys/stat.h>
#include <string.h>
#include <dlfcn.h>
#include <sys/time.h>
/* Non standards includes */
#include <papihighlevel.h>
@ -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());
/*