diff options
author | myang6 <myang6@hdfgroup.org> | 2021-10-18 22:40:11 (GMT) |
---|---|---|
committer | myang6 <myang6@hdfgroup.org> | 2021-10-18 22:40:11 (GMT) |
commit | 5d9248aab77f06f8b1943374ba4ba24a322ad31d (patch) | |
tree | 05464ed0eb0f60a4287f8b1b6160c83c67c1e48b /src | |
parent | 383fd055affb3e003828fc42fba726583ebeebca (diff) | |
parent | cbf5ca9147e229373d8ee75df3f60d1f01211b2a (diff) | |
download | hdf5-5d9248aab77f06f8b1943374ba4ba24a322ad31d.zip hdf5-5d9248aab77f06f8b1943374ba4ba24a322ad31d.tar.gz hdf5-5d9248aab77f06f8b1943374ba4ba24a322ad31d.tar.bz2 |
Merge branch 'vfd_swmr_log' of https://github.com/kyang2014/hdf5 into vfd_swmr_log
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDvfd_swmr_private.h | 5 | ||||
-rw-r--r-- | src/H5Fint.c | 8 | ||||
-rw-r--r-- | src/H5Fpkg.h | 8 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 48 |
4 files changed, 33 insertions, 36 deletions
diff --git a/src/H5FDvfd_swmr_private.h b/src/H5FDvfd_swmr_private.h index 6a35ec0..f9b8f15 100644 --- a/src/H5FDvfd_swmr_private.h +++ b/src/H5FDvfd_swmr_private.h @@ -84,7 +84,6 @@ H5_DLL herr_t H5F_vfd_swmr_insert_entry_eot(struct H5F_t *f); H5_DLL void H5F_vfd_swmr_update_entry_eot(eot_queue_entry_t *); H5_DLL herr_t H5F_dump_eot_queue(void); - /***************************************/ /* Log Macros and Functions */ /***************************************/ @@ -96,7 +95,7 @@ H5_DLL herr_t H5F_dump_eot_queue(void); #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"}; +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 9d739b7..a50c38c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2017,12 +2017,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (vfd_swmr_config_ptr->version) { if (HDstrlen(vfd_swmr_config_ptr->log_file_path) > 0) - shared->vfd_swmr_log_on = TRUE; + shared->vfd_swmr_log_on = TRUE; if (TRUE == shared->vfd_swmr_log_on) { /* Create the log file */ - if ((shared->vfd_swmr_log_file_ptr = HDfopen(vfd_swmr_config_ptr->log_file_path,"w"))==NULL) + if ((shared->vfd_swmr_log_file_ptr = HDfopen(vfd_swmr_config_ptr->log_file_path, "w")) == NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create the log file") - if(HDclock_gettime(CLOCK_MONOTONIC, &(shared->vfd_swmr_log_start_time))<0) + if (HDclock_gettime(CLOCK_MONOTONIC, &(shared->vfd_swmr_log_start_time)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get time via clock_gettime"); } } @@ -2237,7 +2237,7 @@ done: } #if 1 /*KENT*/ H5F_post_vfd_swrm_log_entry(file, 0, "File open ends"); -#endif +#endif if (vfd_swmr_config_ptr) H5MM_free(vfd_swmr_config_ptr); diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 3ab0cd3..5cb1ecb 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -469,9 +469,9 @@ struct H5F_shared_t { * manager */ - FILE* vfd_swmr_log_file_ptr; - hbool_t vfd_swmr_log_on; - struct timespec vfd_swmr_log_start_time; + FILE * vfd_swmr_log_file_ptr; + hbool_t vfd_swmr_log_on; + struct timespec vfd_swmr_log_start_time; /* Delayed free space release doubly linked list */ shadow_defree_queue_t shadow_defrees; @@ -612,5 +612,5 @@ 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); +H5_DLL herr_t H5F_post_vfd_swrm_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 1b9650f..c938014 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -276,7 +276,6 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) - HDassert(shared->vfd_swmr_writer); HDassert(shared->vfd_swmr_md_fd >= 0); @@ -320,11 +319,11 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update end of tick"); } 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); + HDfclose(shared->vfd_swmr_log_file_ptr); } FUNC_LEAVE_NOAPI(ret_value) } @@ -634,7 +633,6 @@ H5F_vfd_swmr_writer__prep_for_flush_or_close(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) - HDassert(shared->vfd_swmr); HDassert(shared->vfd_swmr_writer); HDassert(shared->page_buf); @@ -764,9 +762,9 @@ 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; - struct timespec start_time,end_time; - unsigned int temp_time; - char* log_msg; + struct timespec start_time, end_time; + unsigned int temp_time; + char * log_msg; FUNC_ENTER_NOAPI(FAIL) @@ -774,9 +772,9 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader) HDassert(shared->page_buf); HDassert(shared->vfd_swmr_writer); - if(f->shared->vfd_swmr_log_on == true) { - H5F_post_vfd_swrm_log_entry(f, 3, "EOT gets started"); - if(HDclock_gettime(CLOCK_MONOTONIC, &start_time)<0) + if (f->shared->vfd_swmr_log_on == true) { + H5F_post_vfd_swrm_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"); } if (!vfd_swmr_writer_may_increase_tick_to(shared->tick_num + 1, wait_for_reader)) @@ -901,13 +899,13 @@ update_eot: HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to insert entry into the EOT queue") done: - if(f->shared->vfd_swmr_log_on == true) { - if(HDclock_gettime(CLOCK_MONOTONIC, &end_time)<0) + if (f->shared->vfd_swmr_log_on == true) { + 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)); - HDsprintf(log_msg,"Writer time is %u milliseconds",temp_time); - H5F_post_vfd_swrm_log_entry(f, 3, log_msg); + log_msg = HDmalloc(48); + temp_time = (unsigned int)(TOTAL_TIME_PASSED(start_time, end_time)); + HDsprintf(log_msg, "Writer time is %u milliseconds", temp_time); + H5F_post_vfd_swrm_log_entry(f, 3, log_msg); HDfree(log_msg); } FUNC_LEAVE_NOAPI(ret_value) @@ -1914,20 +1912,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } -herr_t +herr_t H5F_post_vfd_swrm_log_entry(H5F_t *f, int entry_type_code, char *body) { - herr_t ret_value = SUCCEED; - double temp_time; - struct timespec current_time; + 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(f==NULL) + if (f==NULL) HGOTO_DONE(TRUE) - if(f->shared->vfd_swmr_log_on == false) + if (f->shared->vfd_swmr_log_on == false) HGOTO_DONE(TRUE) - if(HDclock_gettime(CLOCK_MONOTONIC, ¤t_time)<0) + 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); @@ -1935,8 +1933,8 @@ 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.*/ - 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); + 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); done: FUNC_LEAVE_NOAPI(ret_value) |