summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-01-30 20:10:07 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:31:54 (GMT)
commit66334f899d19edc01cf83bebbc6dcec914b3dfa3 (patch)
tree6372249a23e69edac0764889fdddb27d75385632 /test
parentd21d9aa1fb6823a4695edea4a55a71b4de7fddb9 (diff)
downloadhdf5-66334f899d19edc01cf83bebbc6dcec914b3dfa3.zip
hdf5-66334f899d19edc01cf83bebbc6dcec914b3dfa3.tar.gz
hdf5-66334f899d19edc01cf83bebbc6dcec914b3dfa3.tar.bz2
Temporarily add some code that measures the time to run the simplest possible
H5T__copy_all()-like routine 10 million times and then measures the version with FUNC_ENTER_STATIC/_LEAVE_NOAPI and a HGOTO_ERROR() statement.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am2
-rw-r--r--test/dtypes.c44
-rw-r--r--test/nop.c29
3 files changed, 75 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 4e95641..0be011f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -155,6 +155,8 @@ libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_
# Use libhd5test.la to compile all of the tests
LDADD=libh5test.la $(LIBHDF5)
+dtypes_SOURCES=dtypes.c nop.c
+
# List the source files for tests that have more than one
ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \
ttsafe_acreate.c
diff --git a/test/dtypes.c b/test/dtypes.c
index 98abe5c..25a3088 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -7815,6 +7815,30 @@ error:
return 1;
} /* end test_versionbounds() */
+herr_t no_operation(H5T_t *t, int mode);
+herr_t H5T__forward_args_with_func_overhead(H5T_t *t);
+herr_t H5T__forward_args_without_func_overhead(H5T_t *t);
+
+herr_t
+H5T__forward_args_with_func_overhead(H5T_t *t)
+{
+ herr_t ret_value = FAIL;
+
+ FUNC_ENTER_STATIC
+
+ if ((ret_value = no_operation(t, 10)) == FAIL)
+ HGOTO_ERROR(17, 31, FAIL, "that didn't work");
+
+ ret_value = SUCCEED;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5T__forward_args_without_func_overhead(H5T_t *t)
+{
+ return no_operation(t, 10);
+}
/*-------------------------------------------------------------------------
* Function: main
@@ -7837,6 +7861,9 @@ main(void)
{
long nerrors = 0;
hid_t fapl = -1;
+ H5T_t *t;
+ int i, ntimes = 10 * 1000 * 1000;
+ uint64_t start, stop;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7847,6 +7874,23 @@ main(void)
if(ALIGNMENT)
printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ t = (H5T_t *)H5I_object(H5T_NATIVE_SHORT);
+ if (t == NULL) abort();
+
+ start = __builtin_ia32_rdtsc();
+ for (i = 0; i < ntimes; i++)
+ H5T__forward_args_without_func_overhead(t);
+ stop = __builtin_ia32_rdtsc();
+ printf("%d calls to no-overhead version, %" PRIu64 " cycles\n",
+ ntimes, stop - start);
+
+ start = __builtin_ia32_rdtsc();
+ for (i = 0; i < ntimes; i++)
+ H5T__forward_args_with_func_overhead(t);
+ stop = __builtin_ia32_rdtsc();
+ printf("%d calls to overhead version, %" PRIu64 " cycles\n",
+ ntimes, stop - start);
+
/* Do the tests */
nerrors += test_classes();
nerrors += test_copy();
diff --git a/test/nop.c b/test/nop.c
new file mode 100644
index 0000000..4829eb9
--- /dev/null
+++ b/test/nop.c
@@ -0,0 +1,29 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "testhdf5.h"
+#include "H5srcdir.h"
+#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
+
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h"
+
+herr_t no_operation(H5T_t *t, int mode);
+
+herr_t
+no_operation(H5T_t *t, int mode)
+{
+ static int ncalls = 0;
+ ncalls++;
+ return SUCCEED;
+}