Commit d88e8161 authored by Shane Snyder's avatar Shane Snyder
Browse files

two darshan_core_wtime fixes

1) make sure wtime_offset is set properly when using MPI
2) fix ifdef logic to properly get wtime in all non-MPI cases
parent 2178526f
...@@ -279,10 +279,6 @@ void darshan_core_initialize(int argc, char **argv) ...@@ -279,10 +279,6 @@ void darshan_core_initialize(int argc, char **argv)
if(init_core) if(init_core)
{ {
memset(init_core, 0, sizeof(*init_core)); memset(init_core, 0, sizeof(*init_core));
/* record absolute start time at startup so that we can later
* generate relative times with this as a reference point.
*/
init_core->wtime_offset = darshan_core_wtime_absolute();
#ifdef HAVE_MPI #ifdef HAVE_MPI
PMPI_Initialized(&using_mpi); PMPI_Initialized(&using_mpi);
...@@ -294,6 +290,11 @@ void darshan_core_initialize(int argc, char **argv) ...@@ -294,6 +290,11 @@ void darshan_core_initialize(int argc, char **argv)
} }
#endif #endif
/* record absolute start time at startup so that we can later
* generate relative times with this as a reference point.
*/
init_core->wtime_offset = darshan_core_wtime_absolute();
/* TODO: do we alloc new memory as we go or just do everything up front? */ /* TODO: do we alloc new memory as we go or just do everything up front? */
#ifndef __DARSHAN_ENABLE_MMAP_LOGS #ifndef __DARSHAN_ENABLE_MMAP_LOGS
...@@ -2352,11 +2353,11 @@ static double darshan_core_wtime_absolute(void) ...@@ -2352,11 +2353,11 @@ static double darshan_core_wtime_absolute(void)
#ifdef HAVE_MPI #ifdef HAVE_MPI
if(using_mpi) if(using_mpi)
return(PMPI_Wtime()); return(PMPI_Wtime());
#else #endif
struct timeval tval; struct timeval tval;
gettimeofday(&tval, NULL); gettimeofday(&tval, NULL);
return(tval.tv_sec + (tval.tv_usec / 1000000.0)); return(tval.tv_sec + (tval.tv_usec / 1000000.0));
#endif
} }
#ifdef DARSHAN_PRELOAD #ifdef DARSHAN_PRELOAD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment