diff options
author | myang6 <myang6@hdfgroup.org> | 2021-10-25 18:12:23 (GMT) |
---|---|---|
committer | myang6 <myang6@hdfgroup.org> | 2021-10-25 18:12:23 (GMT) |
commit | 56e0e6ad352c895e35718cec51d346fa45430382 (patch) | |
tree | 5d65be16c72b6fa3a1aadeafa07d34debe725d48 /src | |
parent | c17ec107bb9d3afd99774e66fba2a6c8f8ca5142 (diff) | |
download | hdf5-56e0e6ad352c895e35718cec51d346fa45430382.zip hdf5-56e0e6ad352c895e35718cec51d346fa45430382.tar.gz hdf5-56e0e6ad352c895e35718cec51d346fa45430382.tar.bz2 |
add macro, need to debug an error caused by using the macro
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDvfd_swmr_private.h | 5 | ||||
-rw-r--r-- | src/H5Fint.c | 5 | ||||
-rw-r--r-- | src/H5Fpkg.h | 9 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 31 |
4 files changed, 34 insertions, 16 deletions
diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index f9b8f15..f040af3 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -89,13 +89,14 @@ H5_DLL herr_t H5F_dump_eot_queue(void); /***************************************/ #define TOTAL_TIME_PASSED(X, Y) \ - ((double)((Y.tv_sec - X.tv_sec) * 1000000000 + (Y.tv_nsec - X.tv_nsec))) / 1000000.0 + ((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", +static const char *H5Fvfd_swmr_log_tags[] = {"FILE_OPEN", + "FILE_CLOSE", "EOT_TRIGGER_TIME", "EOT_PROCESSING_TIME", "EOT_META_FILE_INDEX"}; #endif /* H5FDvfd_swmr_private_H */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 9c4a143..b681c23 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2224,10 +2224,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Success */ ret_value = file; -done: #if 1 /*KENT*/ - H5F_post_vfd_swrm_log_entry(file, 0, "File open ends"); + //H5F_post_vfd_swmr_log_entry(file, 0, "File open ends"); + H5F_POST_VFD_SWMR_LOG_ENTRY(file, 0, "File open ends") #endif +done: if ((NULL == ret_value) && file) { if (file->shared->root_grp && file->shared->nrefs == 1) { if (H5AC_expunge_tag_type_metadata(file, H5G_oloc(file->shared->root_grp)->addr, H5AC_OHDR_ID, diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 5cb1ecb..7b93c72 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -612,5 +612,12 @@ 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 */ -H5_DLL herr_t H5F_post_vfd_swrm_log_entry(H5F_t *f, int entry_type_code, char *body); +#define H5F_POST_VFD_SWMR_LOG_ENTRY(fp,entry_type_code,body) \ +if (fp !=NULL) \ + if (fp->shared != NULL) \ + if (fp->shared->vfd_swmr_log_on == TRUE) \ + H5F_post_vfd_swmr_log_entry(fp,entry_type_code,body); + + +H5_DLL herr_t H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *body); #endif /* H5Fpkg_H */ diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index ee9ccda..9031176 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -318,10 +318,11 @@ 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") done: - H5F_post_vfd_swrm_log_entry(f, 1, "File close ends"); - if (shared->vfd_swmr_log_on) { HDfclose(shared->vfd_swmr_log_file_ptr); } @@ -637,7 +638,7 @@ H5F_vfd_swmr_writer__prep_for_flush_or_close(H5F_t *f) HDassert(shared->vfd_swmr_writer); HDassert(shared->page_buf); - H5F_post_vfd_swrm_log_entry(f, 1, "File close starts"); + 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 @@ -773,7 +774,7 @@ 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_swrm_log_entry(f, 3, "EOT gets started"); + 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"); } @@ -903,9 +904,9 @@ done: if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via clock_gettime"); log_msg = HDmalloc(48); - temp_time = (unsigned int)(TOTAL_TIME_PASSED(start_time, end_time)); + 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_swrm_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,7 +1914,7 @@ done: } herr_t -H5F_post_vfd_swrm_log_entry(H5F_t *f, int entry_type_code, char *body) +H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *body) { herr_t ret_value = SUCCEED; double temp_time; @@ -1925,13 +1926,15 @@ H5F_post_vfd_swrm_log_entry(H5F_t *f, int entry_type_code, char *body) HDassert(f); HDassert(f->shared); #endif +#if 0 if (f == NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(SUCCEED) else if (f->shared == NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(SUCCEED) if (f->shared->vfd_swmr_log_on == false) - HGOTO_DONE(TRUE) - if (HDclock_gettime(CLOCK_MONOTONIC, ¤t_time) < 0) + 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); @@ -1939,9 +1942,15 @@ H5F_post_vfd_swrm_log_entry(H5F_t *f, int entry_type_code, char *body) 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) } |