diff options
author | myang6 <myang6@hdfgroup.org> | 2021-10-25 19:51:28 (GMT) |
---|---|---|
committer | myang6 <myang6@hdfgroup.org> | 2021-10-25 19:51:28 (GMT) |
commit | 09e891477e3946e48d2216e06aca150ad5f2ddb3 (patch) | |
tree | 6c37cc6c9f593b6046b2d4a9a8ef66c6c58b65cb /src | |
parent | d89fb6e09c0e4c8470a919082ac292c8d23c8fab (diff) | |
download | hdf5-09e891477e3946e48d2216e06aca150ad5f2ddb3.zip hdf5-09e891477e3946e48d2216e06aca150ad5f2ddb3.tar.gz hdf5-09e891477e3946e48d2216e06aca150ad5f2ddb3.tar.bz2 |
Update comments, formats etc.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDvfd_swmr_private.h | 23 | ||||
-rw-r--r-- | src/H5Fint.c | 11 | ||||
-rw-r--r-- | src/H5Fpkg.h | 4 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 34 |
4 files changed, 36 insertions, 36 deletions
diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index bc5c177..333bcc7 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -88,14 +88,33 @@ H5_DLL herr_t H5F_dump_eot_queue(void); /* Log Macros and Functions */ /***************************************/ +/* VFD SWMR Helper macros to calcuate the elapsed time */ +/* The total time in seconds */ #define TOTAL_TIME_PASSED(X, Y) \ ((double)((Y.tv_sec - X.tv_sec) * 1000000000 + (Y.tv_nsec - X.tv_nsec))) / 1000000000.0 + +/* #define TIME_PASSED_MIN(X) (unsigned int)(X / 60000) #define TIME_PASSED_SEC(X, Y) (unsigned int)((X - Y * 60000) / 1000) #define TIME_PASSED_MSEC(X, Y, Z) (unsigned int)(X - Y * 60000 - Z * 1000) +*/ /* Add more tags */ -static const char *H5Fvfd_swmr_log_tags[] = {"FILE_OPEN", "FILE_CLOSE", "EOT_TRIGGER_TIME", - "EOT_PROCESSING_TIME", "EOT_META_FILE_INDEX"}; +/* The VFD SMWR Log tags. Note this array of string is used to generate the + * entry tag by the log reporting function H5F_POST_VFD_SWMR_LOG_ENTRY. + * If the entry code is 0, H5Fvfd_swmr_log_tags[0] is used to report the entry tag. + * H5F_POST_VFD_SWMR_LOG_ENTRY(f, 3, log_msg) will put the log_msg attached to + * the entry tag "EOT_PROCESSING_TIME". + */ +/* clang-format off */ +/* The entry code number is listed in the comment for convenience. */ +static const char *H5Fvfd_swmr_log_tags[] = { + "FILE_OPEN", /* 0 */ + "FILE_CLOSE", /* 1 */ + "EOT_TRIGGER_TIME", /* 2 */ + "EOT_PROCESSING_TIME", /* 3 */ + "EOT_META_FILE_INDEX" /* 4 */ + }; +/* clang-format on */ #endif /* H5FDvfd_swmr_private_H */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 04e913e..f6b4e1a 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2013,9 +2013,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Short cuts */ shared = file->shared; -#if 1 /* Kent*/ + + /* Set up the VFD SWMR LOG file */ + /* Kent*/ if (vfd_swmr_config_ptr->version) { - if (HDstrlen(vfd_swmr_config_ptr->log_file_path) > 0) shared->vfd_swmr_log_on = TRUE; if (TRUE == shared->vfd_swmr_log_on) { @@ -2026,7 +2027,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get time via clock_gettime"); } } -#endif + /* End of Kent */ + lf = shared->lf; /* Set the file locking flag. If the file is already open, the file @@ -2224,8 +2226,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Success */ ret_value = file; -#if 1 /*KENT*/ - // H5F_post_vfd_swmr_log_entry(file, 0, "File open ends"); +#if 1 /*Kent: write to the log file when H5F_open ends. Tested, now comment out.*/ H5F_POST_VFD_SWMR_LOG_ENTRY(file, 0, "File open ends") #endif done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index cf68c8c..5eaee3c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -612,6 +612,10 @@ H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); H5_DLL herr_t H5F__reparse_file_lock_variable_test(void); #endif /* H5F_TESTING */ +/* VFD SMWR log reporting macros */ +/* The first argument is the HDF5 file pointer(H5F_t *). Its value needs to be checked + * to avoid a failure caused by "Low-Level File I/O " in the testhdf5 which involves + * the test of a non-existing HDF5 file. */ #define H5F_POST_VFD_SWMR_LOG_ENTRY(fp, entry_type_code, body) \ if (fp != NULL) \ if (fp->shared != NULL) \ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 1bfe65b..3bc405f 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -318,9 +318,9 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) if (H5F__vfd_swmr_update_end_of_tick_and_tick_num(shared, TRUE) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update end of tick"); } - // if(H5F_post_vfd_swmr_log_entry(f, 1, "File close ends")<0) - // HDONE_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "Fail to report VFD SMWR logging info."); - H5F_POST_VFD_SWMR_LOG_ENTRY(f, 1, "File close ends") +#if 1 /*Kent */ + H5F_POST_VFD_SWMR_LOG_ENTRY(f, 1, "VFD SWMR File close or flush ends") +#endif done: if (shared->vfd_swmr_log_on) { @@ -638,8 +638,6 @@ H5F_vfd_swmr_writer__prep_for_flush_or_close(H5F_t *f) HDassert(shared->vfd_swmr_writer); HDassert(shared->page_buf); - H5F_post_vfd_swmr_log_entry(f, 1, "File close starts"); - /* since we are about to flush the page buffer, force and end of * tick so as to avoid attempts to flush entries on the page buffer * tick list that were modified during the current tick. @@ -774,7 +772,6 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) HDassert(shared->vfd_swmr_writer); if (f->shared->vfd_swmr_log_on == true) { - H5F_post_vfd_swmr_log_entry(f, 3, "EOT gets started"); if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via clock_gettime"); } @@ -906,7 +903,7 @@ done: log_msg = HDmalloc(48); temp_time = (unsigned int)(TOTAL_TIME_PASSED(start_time, end_time) * 1000); HDsprintf(log_msg, "Writer time is %u milliseconds", temp_time); - H5F_post_vfd_swmr_log_entry(f, 3, log_msg); + H5F_POST_VFD_SWMR_LOG_ENTRY(f, 3, log_msg) HDfree(log_msg); } FUNC_LEAVE_NOAPI(ret_value) @@ -1913,44 +1910,23 @@ done: FUNC_LEAVE_NOAPI(ret_value) } +/* Log reporting function, called by macro H5F_POST_VFD_SWMR_LOG_ENTRY */ herr_t H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *body) { herr_t ret_value = SUCCEED; double temp_time; struct timespec current_time; - unsigned int elap_min, elap_sec, elap_msec; FUNC_ENTER_NOAPI(FAIL) -#if 0 - HDassert(f); - HDassert(f->shared); -#endif -#if 0 - if (f == NULL) - HGOTO_DONE(SUCCEED) - else if (f->shared == NULL) - HGOTO_DONE(SUCCEED) - if (f->shared->vfd_swmr_log_on == false) - HGOTO_DONE(SUCCEED) -#endif if (HDclock_gettime(CLOCK_MONOTONIC, ¤t_time) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via clock_gettime"); temp_time = TOTAL_TIME_PASSED(f->shared->vfd_swmr_log_start_time, current_time); - elap_min = TIME_PASSED_MIN(temp_time); - elap_sec = TIME_PASSED_SEC(temp_time, elap_min); - elap_msec = TIME_PASSED_MSEC(temp_time, elap_min, elap_sec); /* TODO: add a check for the range of entry_type_code to separate debug mode from the production mode.*/ -#if 0 - HDfprintf(f->shared->vfd_swmr_log_file_ptr, "%s: %u m %u s %u ms, Content - %s\n", - H5Fvfd_swmr_log_tags[entry_type_code], elap_min, elap_sec, elap_msec, body); -#endif - HDfprintf(f->shared->vfd_swmr_log_file_ptr, "%-25s: %.3lf s: %s\n", H5Fvfd_swmr_log_tags[entry_type_code], temp_time, body); done: - // return ret_value; FUNC_LEAVE_NOAPI(ret_value) } |