summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
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/dtypes.c
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/dtypes.c')
-rw-r--r--test/dtypes.c44
1 files changed, 44 insertions, 0 deletions
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();