diff options
author | Muqun Yang <myang6@hdfgroup.org> | 2021-07-02 18:11:24 (GMT) |
---|---|---|
committer | Muqun Yang <myang6@hdfgroup.org> | 2021-07-02 18:11:24 (GMT) |
commit | 354c1237a51737b87b4d8a6ce4acb564eb26abcb (patch) | |
tree | bfe9e9453bbae703b0c3a12f901138ca99276a2b /test/vfd_swmr_gperf_writer.c | |
parent | 9d07011f4e2d8c5fd870c61e855d13a688940a18 (diff) | |
parent | 3dc6265bae206cd0705a0a5dfb9c5bd2f67c57ed (diff) | |
download | hdf5-354c1237a51737b87b4d8a6ce4acb564eb26abcb.zip hdf5-354c1237a51737b87b4d8a6ce4acb564eb26abcb.tar.gz hdf5-354c1237a51737b87b4d8a6ce4acb564eb26abcb.tar.bz2 |
Merge branch 'feature/vfd_swmr' of https://github.com/kyang2014/hdf5 into feature/vfd_swmr
Diffstat (limited to 'test/vfd_swmr_gperf_writer.c')
-rw-r--r-- | test/vfd_swmr_gperf_writer.c | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/test/vfd_swmr_gperf_writer.c b/test/vfd_swmr_gperf_writer.c index cf12585..a3b5455 100644 --- a/test/vfd_swmr_gperf_writer.c +++ b/test/vfd_swmr_gperf_writer.c @@ -26,8 +26,8 @@ #define READER_WAIT_TICKS 3 #define VS_ATTR_NAME_LEN 21 -#define TIME_PASSED(X,Y) \ - ((double)((Y.tv_sec - X.tv_sec) * 1000000000 + (Y.tv_nsec - X.tv_nsec))) / 1000000000.0 +#define TIME_PASSED(X, Y) \ + ((double)((Y.tv_sec - X.tv_sec) * 1000000000 + (Y.tv_nsec - X.tv_nsec))) / 1000000000.0 typedef struct { hid_t file, filetype, one_by_one_sid; @@ -1737,14 +1737,14 @@ add_group_attribute(state_t *s, hid_t g, hid_t gcpl, unsigned int which) static bool write_group(state_t *s, unsigned int which) { - char name[sizeof("/group-9999999999")]; - hid_t g = H5I_INVALID_HID; - hid_t dummy_d = H5I_INVALID_HID; - hid_t gcpl = H5I_INVALID_HID; - bool result = true; - H5G_info_t group_info; + char name[sizeof("/group-9999999999")]; + hid_t g = H5I_INVALID_HID; + hid_t dummy_d = H5I_INVALID_HID; + hid_t gcpl = H5I_INVALID_HID; + bool result = true; + H5G_info_t group_info; struct timespec start_time, end_time; - double temp_time; + double temp_time; if (which >= s->nsteps) { printf("Number of created groups is out of bounds\n"); @@ -1773,42 +1773,36 @@ write_group(state_t *s, unsigned int which) } #endif - if(s->gperf) { - - if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - - fprintf(stderr, "HDclock_gettime failed"); - - TEST_ERROR; + if (s->gperf) { - } + if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { + fprintf(stderr, "HDclock_gettime failed"); + TEST_ERROR; + } } if ((g = H5Gcreate2(s->file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { printf("H5Gcreate2 failed\n"); TEST_ERROR; } - if(s->gperf) { - - if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - - fprintf(stderr, "HDclock_gettime failed"); + if (s->gperf) { - TEST_ERROR; + if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - } + fprintf(stderr, "HDclock_gettime failed"); + TEST_ERROR; + } - temp_time = TIME_PASSED(start_time,end_time); - if(temp_time < s->min_time) + temp_time = TIME_PASSED(start_time, end_time); + if (temp_time < s->min_time) s->min_time = temp_time; - if(temp_time > s->max_time) + if (temp_time > s->max_time) s->max_time = temp_time; - s->total_time += temp_time; + s->total_time += temp_time; } - #if 0 /* We need to create a dummy dataset for the object header continuation block test. */ @@ -1883,13 +1877,12 @@ write_group(state_t *s, unsigned int which) TEST_ERROR; } - return result; error: - - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Gclose(g); } H5E_END_TRY; @@ -5163,11 +5156,11 @@ main(int argc, char **argv) } } } - s.mean_time = s.total_time/s.nsteps; - fprintf(stdout, "group creation min. time = %lf\n", s.min_time); - fprintf(stdout, "group creation max. time = %lf\n", s.max_time); - fprintf(stdout, "group creation mean time = %lf\n", s.mean_time); - fprintf(stdout, "group creation total time = %lf\n", s.total_time); + s.mean_time = s.total_time / s.nsteps; + fprintf(stdout, "group creation min. time = %lf\n", s.min_time); + fprintf(stdout, "group creation max. time = %lf\n", s.max_time); + fprintf(stdout, "group creation mean time = %lf\n", s.mean_time); + fprintf(stdout, "group creation total time = %lf\n", s.total_time); } else { for (step = 0; step < s.nsteps; step++) { |