[quagga-dev 10148] [PATCH 3/4] configure: allow building without getrusage

Stephen Hemminger shemminger at vyatta.com
Fri Jan 4 23:29:22 GMT 2013


Measuring the resource usage of threads is moderately expensive
since it requires doing an additional system call everytime a
thread context switches. Make it possible to disable this with
a configuration option.
---
 configure.ac |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index fb6efd7..68a9da8 100755
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,8 @@ AC_ARG_ENABLE(isis_topology,
 [  --enable-isis-topology        enable IS-IS topology generator])
 AC_ARG_ENABLE(capabilities,
 [  --disable-capabilities        disable using POSIX capabilities])
+AC_ARG_ENABLE(rusage,
+[  --disable-rusage              disable using getrusage])
 AC_ARG_ENABLE(gcc_ultra_verbose,
 [  --enable-gcc-ultra-verbose    enable ultra verbose GCC warnings])
 AC_ARG_ENABLE(linux24_tcp_md5,
@@ -1482,12 +1484,13 @@ AC_CHECK_TYPES([struct in_pktinfo],
 dnl --------------------------------------
 dnl checking for getrusage struct and call
 dnl --------------------------------------
-AC_MSG_CHECKING(whether getrusage is available)
-AC_TRY_COMPILE([#include <sys/resource.h>
-],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_RUSAGE,,rusage)],
- AC_MSG_RESULT(no))
+if test "${enable_rusage}" != "no"; then
+  AC_MSG_CHECKING(whether getrusage is available)
+  AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
+    [AC_MSG_RESULT(yes)
+     AC_DEFINE(HAVE_RUSAGE,,rusage)],
+      AC_MSG_RESULT(no))
+fi
 
 dnl --------------------------------------
 dnl checking for clock_time monotonic struct and call
-- 
1.7.10.4





More information about the Quagga-dev mailing list