diff options
-rw-r--r-- | src/H5Fpkg.h | 38 | ||||
-rw-r--r-- | src/H5Fvfd_swmr.c | 35 | ||||
-rw-r--r-- | test/vfd_swmr_log_writer.c | 6 |
3 files changed, 39 insertions, 40 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2fc896a..578c6ab 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -612,11 +612,11 @@ 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 */ +/* VFD SMWR LOG REPORTING MACROS */ -/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that needs to be used by the developers. +/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that needs to be used by the developers. * It calls an internal reporting function H5F_post_vfd_swmr_log_entry() that receives - * the log entry_type_code, which generates the log tag, and the message log_info, which + * the log entry_type_code, which generates the log tag, and the message log_info, which * the library developer wants to save into the log file. * * The macro H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(f, c, number_entry_production, m) is @@ -625,34 +625,34 @@ H5_DLL herr_t H5F__reparse_file_lock_variable_test(void); * applications can receive. Currently this number is set to 1 and is subject to change * when more tags are useful to be present to applications. * - * The first argument of the macro is the HDF5 file pointer(H5F_t *). - * Its value needs to be checked to avoid a failure caused by "Low-Level File I/O " + * The first argument of the macro 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 program, which involves the test of a non-existing HDF5 file. */ H5_DLL void H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info); -#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \ +#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \ do { \ - 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, log_info); \ - } \ - } \ - } \ + 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, log_info); \ + } \ + } \ + } \ } while (0) -#define H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(fp, entry_type_code, max_code, log_info) \ +#define H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(fp, entry_type_code, max_code, log_info) \ do { \ - if (entry_type_code <max_code) { \ - H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp,entry_type_code,log_info); \ - } \ + if (entry_type_code < max_code) { \ + H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info); \ + } \ } while (0) -/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(f, c, 1, m) on the following lines to +/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(f, c, 1, m) on the following lines to * H5F_POST_VFD_SWMR_LOG_ENTRY_RELEASE(f, c, your_number_entry_production, m) - * as necessary. + * as necessary. */ #ifndef NDEBUG #define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(f, c, m) diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 3f24352..12c8905 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -54,7 +54,7 @@ #define nanosecs_per_second 1000000000 /* nanoseconds per second */ #define nanosecs_per_tenth_sec 100000000 /* nanoseconds per 0.1 second */ -/* Declare an array of string to identify the VFD SMWR Log tags. +/* Declare an array of string to identify the VFD SMWR Log tags. * Note this array is used to generate the entry tag by the log reporting macro * H5F_POST_VFD_SWMR_LOG_ENTRY. * @@ -63,7 +63,7 @@ * 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, 0, log_msg) will put the log_msg attached to * the entry tag "EOT_PROCESSING_TIME". - * The entry code number is listed in the comment for convenience. + * The entry code number is listed in the comment for convenience. * Currently for the production mode, only the "EOT_PROCESSING_TIME" is present. */ @@ -77,14 +77,14 @@ static const char *H5Fvfd_swmr_log_tags[] = { }; /* clang-format on */ -/* This string defines the format of the VFD SWMR log file. - * The current maximum length of entry tag string is set to 26. - * One can enlarge or reduce this number as necessary. +/* This string defines the format of the VFD SWMR log file. + * The current maximum length of entry tag string is set to 26. + * One can enlarge or reduce this number as necessary. * For example, to enlarge the maximum length of entry tag string to 30, - * Just change 26 to 30 in the following line, like - * const char *log_fmt_str="%-30s: %.3lf s: %s\n"; + * Just change 26 to 30 in the following line, like + * const char *log_fmt_str="%-30s: %.3lf s: %s\n"; */ -const char *log_fmt_str="%-26s: %.3lf s: %s\n"; +const char *log_fmt_str = "%-26s: %.3lf s: %s\n"; /********************/ /* Local Prototypes */ @@ -1958,8 +1958,8 @@ done: * * Parameters: * H5F_t *f IN: HDF5 file pointer - * int entry_type_code IN: The entry type code to identify the - * log entry tag. + * int entry_type_code IN: The entry type code to identify the + * log entry tag. * char *log_info IN: The information to be stored in the * log file. * Return: None @@ -1967,29 +1967,28 @@ done: *------------------------------------------------------------------------- */ -void +void H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info) { double temp_time; struct timespec current_time; - char *gettime_error; + char * gettime_error; - /* Obtain the current time. - If failed, write an error message to the log file. + /* 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 was created and wirte the time to the log file. */ if (HDclock_gettime(CLOCK_MONOTONIC, ¤t_time) < 0) { gettime_error = HDmalloc(14); HDsprintf(gettime_error, "gettime_error"); - HDfprintf(f->shared->vfd_swmr_log_file_ptr, - "%-26s: %s\n", H5Fvfd_swmr_log_tags[entry_type_code], + HDfprintf(f->shared->vfd_swmr_log_file_ptr, "%-26s: %s\n", H5Fvfd_swmr_log_tags[entry_type_code], gettime_error); HDfree(gettime_error); } else { temp_time = TOTAL_TIME_PASSED(f->shared->vfd_swmr_log_start_time, current_time); - HDfprintf(f->shared->vfd_swmr_log_file_ptr,log_fmt_str, - H5Fvfd_swmr_log_tags[entry_type_code], temp_time, log_info); + HDfprintf(f->shared->vfd_swmr_log_file_ptr, log_fmt_str, H5Fvfd_swmr_log_tags[entry_type_code], + temp_time, log_info); } return; } diff --git a/test/vfd_swmr_log_writer.c b/test/vfd_swmr_log_writer.c index 62d8318..d1eef18 100644 --- a/test/vfd_swmr_log_writer.c +++ b/test/vfd_swmr_log_writer.c @@ -11,9 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Description of this program: - * This program shows an example on how a VFD log file can be written. + * This program shows an example on how a VFD log file can be written. * It is adapted from the group performence test. Most options of the - * group performance test are still kept. + * group performance test are still kept. * To turn on the log feature, one just needs to provide the log file path as * indicated by the line init_vfd_swmr_log(&config, "./log-test") in the main * function. The init_vfd_swmr_log is defined inside the vfd_swmr_common.c. @@ -27,7 +27,7 @@ * This program also checks the performance of group creations for VFD SWMR. * Currently the group creation time, H5Fopen and H5Fclose time are measured. * The output can help check the contents in the log-test. - * + * */ #define H5F_FRIEND /*suppress error about including H5Fpkg */ |