From f88ebef63933df7d3c2697ed5c7dbbb413a19f0b Mon Sep 17 00:00:00 2001 From: Phil Carns Date: Sun, 1 May 2016 07:57:38 -0400 Subject: [PATCH] fix minor potential bug in open timestamp - be careful to record start timestamp of first open to start rather than start timestamp of first open to complete --- darshan-runtime/lib/darshan-hdf5.c | 6 ++++-- darshan-runtime/lib/darshan-mpiio.c | 3 ++- darshan-runtime/lib/darshan-pnetcdf.c | 6 ++++-- darshan-runtime/lib/darshan-posix.c | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/darshan-runtime/lib/darshan-hdf5.c b/darshan-runtime/lib/darshan-hdf5.c index e27f073..50a77bd 100644 --- a/darshan-runtime/lib/darshan-hdf5.c +++ b/darshan-runtime/lib/darshan-hdf5.c @@ -115,7 +115,8 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags, file = hdf5_file_by_name_sethid(filename, ret); if(file) { - if(file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] == 0) + if(file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] == 0 || + file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] > tm1) file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] = tm1; file->file_record->counters[HDF5_OPENS] += 1; } @@ -154,7 +155,8 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags, file = hdf5_file_by_name_sethid(filename, ret); if(file) { - if(file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] == 0) + if(file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] == 0 || + file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] > tm1) file->file_record->fcounters[HDF5_F_OPEN_TIMESTAMP] = tm1; file->file_record->counters[HDF5_OPENS] += 1; } diff --git a/darshan-runtime/lib/darshan-mpiio.c b/darshan-runtime/lib/darshan-mpiio.c index 5d60e2b..e946415 100644 --- a/darshan-runtime/lib/darshan-mpiio.c +++ b/darshan-runtime/lib/darshan-mpiio.c @@ -151,7 +151,8 @@ static void mpiio_shutdown(void); file->file_record->counters[MPIIO_COLL_OPENS] += 1; \ if(__info != MPI_INFO_NULL) \ file->file_record->counters[MPIIO_HINTS] += 1; \ - if(file->file_record->fcounters[MPIIO_F_OPEN_TIMESTAMP] == 0) \ + if(file->file_record->fcounters[MPIIO_F_OPEN_TIMESTAMP] == 0 || \ + file->file_record->fcounters[MPIIO_F_OPEN_TIMESTAMP] > __tm1) \ file->file_record->fcounters[MPIIO_F_OPEN_TIMESTAMP] = __tm1; \ DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[MPIIO_F_META_TIME], __tm1, __tm2, file->last_meta_end); \ } while(0) diff --git a/darshan-runtime/lib/darshan-pnetcdf.c b/darshan-runtime/lib/darshan-pnetcdf.c index a0a6344..4b52ec4 100644 --- a/darshan-runtime/lib/darshan-pnetcdf.c +++ b/darshan-runtime/lib/darshan-pnetcdf.c @@ -112,7 +112,8 @@ int DARSHAN_DECL(ncmpi_create)(MPI_Comm comm, const char *path, file = pnetcdf_file_by_name_setncid(path, (*ncidp)); if(file) { - if(file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] == 0) + if(file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] == 0 || + file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] > tm1) file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] = tm1; DARSHAN_MPI_CALL(PMPI_Comm_size)(comm, &comm_size); if(comm_size == 1) @@ -160,7 +161,8 @@ int DARSHAN_DECL(ncmpi_open)(MPI_Comm comm, const char *path, file = pnetcdf_file_by_name_setncid(path, (*ncidp)); if(file) { - if(file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] == 0) + if(file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] == 0 || + file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] > tm1) file->file_record->fcounters[PNETCDF_F_OPEN_TIMESTAMP] = tm1; DARSHAN_MPI_CALL(PMPI_Comm_size)(comm, &comm_size); if(comm_size == 1) diff --git a/darshan-runtime/lib/darshan-posix.c b/darshan-runtime/lib/darshan-posix.c index dd637c4..b83957a 100644 --- a/darshan-runtime/lib/darshan-posix.c +++ b/darshan-runtime/lib/darshan-posix.c @@ -226,7 +226,8 @@ static void posix_shutdown(void); file->file_record->counters[POSIX_FOPENS] += 1; \ else \ file->file_record->counters[POSIX_OPENS] += 1; \ - if(file->file_record->fcounters[POSIX_F_OPEN_TIMESTAMP] == 0) \ + if(file->file_record->fcounters[POSIX_F_OPEN_TIMESTAMP] == 0 || \ + file->file_record->fcounters[POSIX_F_OPEN_TIMESTAMP] > __tm1) \ file->file_record->fcounters[POSIX_F_OPEN_TIMESTAMP] = __tm1; \ DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[POSIX_F_META_TIME], __tm1, __tm2, file->last_meta_end); \ } while(0) -- 2.22.0