2005-04-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* configure.ac: Added AC_ARG_ENABLE(time-check). By default,
warning messages will now be printed for threads or commands that take
longer than 5 seconds, but this configure argument can be used
to disable the checks or change the threshold.
* thread.h (thread_consumed_time): Declare new function to calculate
elapsed microseconds.
* thread.c (thread_consumed_time): Must be global not static so we
can call it from lib/vty.c:vty_command.
(thread_should_yield): Surround with `#if 0' to make clear that this
function is not currently being used anywhere.
(thread_call): If CONSUMED_TIME_CHECK is defined, print a CPU HOG
warning message if the thread takes more than CONSUMED_TIME_CHECK
microseconds.
* vty.c (vty_command): If CONSUMED_TIME_CHECK is defined, print a CPU
HOG warning message if the command takes more than CONSUMED_TIME_CHECK
microseconds.
diff --git a/configure.ac b/configure.ac
index 08b5214..cbc9521 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
##
-## $Id: configure.ac,v 1.103 2005/04/16 15:38:23 paul Exp $
+## $Id: configure.ac,v 1.104 2005/04/16 17:11:24 ajs Exp $
AC_PREREQ(2.53)
AC_INIT(Quagga, 0.99.0, [http://bugzilla.quagga.net])
@@ -195,6 +195,8 @@
[ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
AC_ARG_ENABLE(gcc-rdynamic,
[ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
+AC_ARG_ENABLE(time-check,
+[ --disable-time-check disable slow thread warning messages])
if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
@@ -207,6 +209,14 @@
LDFLAGS="${LDFLAGS} -rdynamic"
fi
+if test x"${enable_time_check}" != x"no" ; then
+ if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
+ AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
+ else
+ AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
+ fi
+fi
+
if test "${enable_broken_aliases}" = "yes"; then
if test "${enable_netlink}" = "yes"
then