diff options
author | Quincey Koziol <koziol@koziol.gov> | 2020-06-28 01:02:51 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2020-06-28 01:02:51 (GMT) |
commit | 71b601d0d3610d508a5dfa0d3a3ff54b71f5090a (patch) | |
tree | bde7d558742dcb06d59659f1c892eb6467d43ade | |
parent | ee4eb09b5f5a562b82ab7c48272edf91988eaf82 (diff) | |
download | hdf5-71b601d0d3610d508a5dfa0d3a3ff54b71f5090a.zip hdf5-71b601d0d3610d508a5dfa0d3a3ff54b71f5090a.tar.gz hdf5-71b601d0d3610d508a5dfa0d3a3ff54b71f5090a.tar.bz2 |
Clean up warnings
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | config/cmake/H5pubconf.h.in | 3 | ||||
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 3 | ||||
-rw-r--r-- | src/H5FDlog.c | 8 | ||||
-rw-r--r-- | src/H5timer.c | 2 | ||||
-rw-r--r-- | test/timer.c | 41 | ||||
-rw-r--r-- | tools/test/perform/chunk_cache.c | 48 |
7 files changed, 53 insertions, 54 deletions
@@ -192,6 +192,7 @@ ./examples/h5_chunk_read.c ./examples/h5_compound.c ./examples/h5_crtgrpd.c +./examples/h5_debug_trace.c ./examples/h5_subset.c ./examples/h5_cmprss.c ./examples/h5_rdwt.c @@ -1228,6 +1229,7 @@ ./test/theap.c ./test/thread_id.c ./test/tid.c +./test/timer.c ./test/titerate.c ./test/tlayouto.h5 ./test/tmeta.c diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index eea12cd..64b4852 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -267,9 +267,6 @@ /* Define to 1 if you have the `lstat' function. */ #cmakedefine H5_HAVE_LSTAT @H5_HAVE_LSTAT@ -/* Define to 1 if you have the <mach/mach_time.h> header file. */ -#cmakedefine H5_HAVE_MACH_MACH_TIME_H @H5_HAVE_MACH_MACH_TIME_H@ - /* Define if the map API (H5M) should be compiled */ #cmakedefine H5_HAVE_MAP_API @H5_HAVE_MAP_API@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 8252736..6f5a835 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -137,9 +137,6 @@ CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -# Darwin -CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) - # Windows CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) if (NOT CYGWIN) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 2700286..78b7742 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1146,9 +1146,11 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; H5_timer_t read_timer; /* Timer for read operation */ - H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t read_times; /* Elapsed time for read operation */ +#ifndef H5_HAVE_PREADWRITE + H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ +#endif /* H5_HAVE_PREADWRITE */ HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ @@ -1348,9 +1350,11 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; H5_timer_t write_timer; /* Timer for write operation */ - H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t write_times; /* Elapsed time for write operation */ +#ifndef H5_HAVE_PREADWRITE + H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ +#endif /* H5_HAVE_PREADWRITE */ HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5timer.c b/src/H5timer.c index 180c774..8f3d305 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -40,7 +40,7 @@ * Most time strings should be < 20 or so characters (max!) so this should be a * safe size. Dynamically allocating the correct size would be painful. */ -#define H5TIMER_TIME_STRING_LEN 256 +#define H5TIMER_TIME_STRING_LEN 1536 /* Conversion factors */ #define H5_SEC_PER_DAY (double)(24.0F * 60.0F * 60.0F) diff --git a/test/timer.c b/test/timer.c index 3a82b82..1014e75 100644 --- a/test/timer.c +++ b/test/timer.c @@ -70,13 +70,13 @@ test_time_formatting(void) HDfree(s); /* < 1 s milliseconds */ - s = H5_timer_get_time_string(4.56789E-3); + s = H5_timer_get_time_string(4.56789E-3F); if(NULL == s || HDstrcmp(s, "4.6 ms") != 0) TEST_ERROR; HDfree(s); /* < 1 min seconds */ - s = H5_timer_get_time_string(3.14); + s = H5_timer_get_time_string(3.14F); if(NULL == s || HDstrcmp(s, "3.14 s") != 0) TEST_ERROR; HDfree(s); @@ -149,7 +149,7 @@ test_timer_system_user(void) /* The system and user times may not be present on some systems. They * will be -1.0 if they are not. */ - if(timer.initial.system < 0.0 || timer.initial.user < 0.0) { + if(timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) { SKIPPED(); printf("NOTE: No suitable way to get system/user times on this platform.\n"); return 0; @@ -157,7 +157,7 @@ test_timer_system_user(void) /* Do some fake work */ for(i=0; i < 1024; i++) { - buf = (char *)HDmalloc(1024 * i * sizeof(char)); + buf = (char *)HDmalloc(1024 * (size_t)i); HDfree(buf); } @@ -170,7 +170,7 @@ test_timer_system_user(void) TEST_ERROR; /* System and user times should be non-negative. */ - if(times.system < 0.0 || times.user < 0.0) + if(times.system < (double)0.0f || times.user < (double)0.0f) TEST_ERROR; PASSED(); @@ -217,7 +217,7 @@ test_timer_elapsed(void) /* Do some fake work */ for(i=0; i < 1024; i++) { - buf = (char *)HDmalloc(1024 * i * sizeof(char)); + buf = (char *)HDmalloc(1024 * (size_t)i); HDfree(buf); } @@ -230,7 +230,7 @@ test_timer_elapsed(void) TEST_ERROR; /* Elapsed time should be non-negative. */ - if(times.elapsed < 0.0) + if(times.elapsed < (double)0.0f) TEST_ERROR; PASSED(); @@ -248,7 +248,7 @@ test_timer_functionality(void) int i; char *buf = NULL; H5_timer_t timer; - + H5_timevals_t times; double prev_etime; double prev_total_etime; @@ -268,11 +268,11 @@ test_timer_functionality(void) /* Times should be initialized to zero */ err = H5_timer_get_times(timer, ×); - if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) TEST_ERROR; @@ -287,7 +287,7 @@ test_timer_functionality(void) /* Do some fake work */ for(i=0; i < 1024; i++) { - buf = (char *)HDmalloc(1024 * i * sizeof(char)); + buf = (char *)HDmalloc(1024 * (size_t)i); HDfree(buf); } @@ -298,11 +298,11 @@ test_timer_functionality(void) /* Times should be positive and non-negative */ err = H5_timer_get_times(timer, ×); - if(err < 0 || times.elapsed < 0.0) + if(err < 0 || times.elapsed < (double)0.0f) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if(err < 0 || times.elapsed < 0.0) + if(err < 0 || times.elapsed < (double)0.0f) TEST_ERROR; @@ -316,11 +316,11 @@ test_timer_functionality(void) TEST_ERROR; err = H5_timer_get_times(timer, ×); - if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) TEST_ERROR; err = H5_timer_get_total_times(timer, ×); - if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, 0.0)) + if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f)) TEST_ERROR; /* Timer state should flip */ @@ -330,24 +330,24 @@ test_timer_functionality(void) /* Do some fake work */ for(i=0; i < 1024; i++) { - buf = (char *)HDmalloc(1024 * i * sizeof(char)); + buf = (char *)HDmalloc(1024 * (size_t)i); HDfree(buf); } /* Times should be non-negative */ err = H5_timer_get_times(timer, ×); - if(err < 0 || times.elapsed < 0.0) + if(err < 0 || times.elapsed < (double)0.0f) TEST_ERROR; prev_etime = times.elapsed; err = H5_timer_get_total_times(timer, ×); - if(err < 0 || times.elapsed < 0.0) + if(err < 0 || times.elapsed < (double)0.0f) TEST_ERROR; prev_total_etime = times.elapsed; - + /* Do some fake work */ for(i=0; i < 1024; i++) { - buf = (char *)HDmalloc(1024 * i * sizeof(char)); + buf = (char *)HDmalloc(1024 * (size_t)i); HDfree(buf); } @@ -401,7 +401,6 @@ main(void) nerrors += test_timer_system_user() < 0 ? 1 : 0; nerrors += test_timer_elapsed() < 0 ? 1 : 0; nerrors += test_timer_functionality() < 0 ? 1 : 0; - if(nerrors) { printf("***** %d platform-independent timer TEST%s FAILED! *****\n", diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index f630da7..d7c56af 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -19,6 +19,7 @@ */ #include "hdf5.h" #include "H5private.h" +#include "h5test.h" #define FILENAME "chunk_cache_perf.h5" @@ -98,8 +99,7 @@ static int create_dset1(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; - int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */ - int i, j; + int **data; /* data for writing */ /* Create the data space. */ if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) @@ -123,9 +123,10 @@ static int create_dset1(hid_t file) H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - for (i = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) - data[i][j] = i+j; + /* Create & fill array */ + H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2); + H5TEST_FILL_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2); + /* Write data to dataset */ if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, @@ -159,17 +160,16 @@ static int create_dset2(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; - int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */ - int i, j; + int **data; /* data for writing */ /* Create the data space. */ - if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) goto error; /* Modify dataset creation properties, i.e. enable chunking */ - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) goto error; /* Set the dummy filter simply for counting the number of bytes being read into the memory */ @@ -179,35 +179,35 @@ static int create_dset2(hid_t file) goto error; /* Create a new dataset within the file using chunk creation properties. */ - if((dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, + if((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - for (i = 0; i < DSET2_DIM1; i++) - for (j = 0; j < DSET2_DIM2; j++) - data[i][j] = i+j; + /* Create & fill array */ + H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2); + H5TEST_FILL_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2); /* Write data to dataset */ - if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Close resources */ - H5Dclose (dataset); - H5Pclose (dcpl); - H5Sclose (dataspace); + H5Dclose(dataset); + H5Pclose(dcpl); + H5Sclose(dataspace); return 0; error: H5E_BEGIN_TRY { - H5Dclose (dataset); - H5Pclose (dcpl); - H5Sclose (dataspace); + H5Dclose(dataset); + H5Pclose(dcpl); + H5Sclose(dataspace); } H5E_END_TRY; return 1; } + /*--------------------------------------------------------------------------- * Check the performance of the chunk cache when partial chunks exist * along the dataset dimensions. @@ -257,7 +257,7 @@ static int check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); - if((end_t - start_t) > 0.0f) + if((end_t - start_t) > (double)0.0f) printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); else printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); @@ -331,7 +331,7 @@ static int check_hash_value_perf(hid_t file) end_t = H5_get_time(); - if((end_t - start_t) > 0.0) + if((end_t - start_t) > (double)0.0f) printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); else printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); |