+2017-10-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR other/67165
+ * configure.ac: Check for clock_gettime.
+ * config.h.in: Regenerate.
+ * configure: Likewise.
+ * ztest.c (average_time, test_large): Conditionalize test timing
+ on clock_gettime availability.
+
2017-09-29 Tony Reix <tony.reix@atos.net>
* xcoff.c: Initial support for DWARF debug sections in XCOFF.
/* Define to 1 if you have the __atomic functions */
#undef HAVE_ATOMIC_FUNCTIONS
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#undef HAVE_DECL_STRNLEN
fi
+# Check for the clock_gettime function.
+for ac_func in clock_gettime
+do :
+ ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
+if test "x$ac_cv_func_clock_gettime" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_CLOCK_GETTIME 1
+_ACEOF
+
+fi
+done
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -pthread is supported" >&5
$as_echo_n "checking whether -pthread is supported... " >&6; }
if test "${libgo_cv_lib_pthread+set}" = set; then :
AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
fi
+# Check for the clock_gettime function.
+AC_CHECK_FUNCS(clock_gettime)
+
dnl Test whether the compiler supports the -pthread option.
AC_CACHE_CHECK([whether -pthread is supported],
[libgo_cv_lib_pthread],
#include <zlib.h>
#endif
+#ifdef HAVE_CLOCK_GETTIME
+# define TEST_TIMING
+#endif
+
#include "backtrace.h"
#include "backtrace-supported.h"
}
}
-#ifdef HAVE_ZLIB
+#if defined HAVE_ZLIB && defined TEST_TIMING
/* Given a set of TRIALS timings, discard the lowest and highest
values and return the mean average of the rest. */
unsigned char *uncompressed_buf;
size_t uncompressed_bufsize;
int r;
+# ifdef TEST_TIMING
clockid_t cid;
struct timespec ts1;
struct timespec ts2;
const size_t trials = 16;
size_t ctimes[16];
size_t ztimes[16];
+# endif /* TEST_TIMING */
static const char * const names[] = {
"Mark.Twain-Tom.Sawyer.txt",
"../libgo/go/compress/testdata/Mark.Twain-Tom.Sawyer.txt"
printf ("PASS: inflate large\n");
+# ifdef TEST_TIMING
+
for (i = 0; i < trials; ++i)
{
cid = CLOCK_REALTIME;
printf ("zlib time: : %zu ns\n", ztime);
printf ("percentage : %g\n", (double) ztime / (double) ctime);
+# endif /* TEST_TIMING */
+
return;
fail: