From b8a775cbe44e3518a817f413993adef7a6eca88f Mon Sep 17 00:00:00 2001 From: myang6 Date: Fri, 29 Oct 2021 15:00:02 -0500 Subject: Update comments to use the HDF5 timer for the log feature. --- src/H5FDvfd_swmr_private.h | 5 ----- src/H5Fint.c | 2 +- src/H5Fvfd_swmr.c | 14 ++++++++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index d0e2380..02e1c44 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -88,9 +88,4 @@ H5_DLL herr_t H5F_dump_eot_queue(void); /* Log Macros and Functions */ /***************************************/ -/* VFD SWMR Helper macro to calcuate the elapsed time */ -/* The total time is in seconds */ -#define TOTAL_TIME_PASSED(X, Y) \ - ((double)((Y.tv_sec - X.tv_sec) * 1000000000 + (Y.tv_nsec - X.tv_nsec))) / 1000000000.0 - #endif /* H5FDvfd_swmr_private_H */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 2937056..1adc7d5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2026,7 +2026,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (H5_timer_init(&(shared->vfd_swmr_log_start_time)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't initialize HDF5 timer.") if (H5_timer_start(&(shared->vfd_swmr_log_start_time)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't start HDF5 timer.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't obtain the time from the HDF5 timer.") } } /* End of Kent */ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index be3dbb6..ce9e468 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -355,7 +355,7 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) #endif done: - /* Kent: close the VFD SWMR log file if it is turned on. + /* Kent: Stop the timer and close the VFD SWMR log file if it is turned on. * Please REVIEW to ensure this is the right place to * close the log file. */ @@ -799,6 +799,8 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) herr_t ret_value = SUCCEED; /* Return value */ hbool_t incr_tick = FALSE; + /* Kent: define the local variables to calculate the EOT time + and write them to the log file. */ H5_timevals_t current_time; double start_elapsed_time, end_elapsed_time; unsigned int temp_time; @@ -813,8 +815,8 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) /* Kent */ /* Obtain the starting time for the logging info: the processing time of this function. */ if (shared->vfd_swmr_log_on == true) { - if (H5_timer_get_times(f->shared->vfd_swmr_log_start_time, ¤t_time) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get H5_timer_get_times") + if (H5_timer_get_times(shared->vfd_swmr_log_start_time, ¤t_time) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time from H5_timer_get_times") start_elapsed_time = current_time.elapsed; } /* Kent */ @@ -943,8 +945,8 @@ update_eot: done: /* Kent: Calcuate the processing time and write the time info to the log file */ if (shared->vfd_swmr_log_on == true) { - if (H5_timer_get_times(f->shared->vfd_swmr_log_start_time, ¤t_time) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get H5_timer_get_times") + if (H5_timer_get_times(shared->vfd_swmr_log_start_time, ¤t_time) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time from H5_timer_get_times") end_elapsed_time = current_time.elapsed; log_msg = HDmalloc(48); temp_time = (unsigned int)((end_elapsed_time - start_elapsed_time) * 1000); @@ -1983,7 +1985,7 @@ H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info) /* Obtain the current time. If failed, write an error message to the log file. - else calcluate the elapsed time in seconds since the log file + else obtain the elapsed time in seconds since the log file was created and write the time to the log file. */ if (H5_timer_get_times(f->shared->vfd_swmr_log_start_time, ¤t_time) < 0) { gettime_error = HDmalloc(14); -- cgit v0.12