Increase iterations, provide a baseline for no-op, simplify the overhead

case a bit.
This commit is contained in:
David Young 2020-01-30 15:46:12 -06:00
parent f398fe6bee
commit 69a064eef8

View File

@ -7819,7 +7819,7 @@ 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
herr_t __attribute__((noinline))
H5T__forward_args_with_func_overhead(H5T_t *t)
{
herr_t ret_value = FAIL;
@ -7829,12 +7829,11 @@ H5T__forward_args_with_func_overhead(H5T_t *t)
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
herr_t __attribute__((noinline))
H5T__forward_args_without_func_overhead(H5T_t *t)
{
return no_operation(t, 10);
@ -7862,7 +7861,7 @@ main(void)
long nerrors = 0;
hid_t fapl = -1;
H5T_t *t;
int i, ntimes = 10 * 1000 * 1000;
int i, ntimes = 100 * 1000 * 1000;
uint64_t start, stop;
/* Set the random # seed */
@ -7877,6 +7876,13 @@ main(void)
t = (H5T_t *)H5I_object(H5T_NATIVE_SHORT);
if (t == NULL) abort();
start = __builtin_ia32_rdtsc();
for (i = 0; i < ntimes; i++)
no_operation(t, 10);
stop = __builtin_ia32_rdtsc();
printf("%d calls to no-op routine, %" PRIu64 " cycles\n",
ntimes, stop - start);
start = __builtin_ia32_rdtsc();
for (i = 0; i < ntimes; i++)
H5T__forward_args_without_func_overhead(t);