diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-23 18:42:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-23 18:42:46 +0000 |
commit | 798b1b3431ccf345a93bd01413a64d272e530c6c (patch) | |
tree | 2aee80048c9615a438fe362f79a8fb5c3b22eeee | |
parent | a25686672d1ca40a856292ee65f45e0e736a7a8f (diff) | |
download | gnunet-798b1b3431ccf345a93bd01413a64d272e530c6c.tar.gz gnunet-798b1b3431ccf345a93bd01413a64d272e530c6c.zip |
-add option to make expensive heap stat gathering optional
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | src/statistics/statistics_api.c | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 28a23f8f0..3caaf253a 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -999,6 +999,15 @@ AC_ARG_ENABLE([experimental], | |||
999 | AC_MSG_RESULT($enable_experimental) | 999 | AC_MSG_RESULT($enable_experimental) |
1000 | AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) | 1000 | AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) |
1001 | 1001 | ||
1002 | # should memory statistics be kept (very expensive CPU-wise!) | ||
1003 | AC_MSG_CHECKING(whether to create expensive statistics on memory use) | ||
1004 | AC_ARG_ENABLE([heapstats], | ||
1005 | [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])], | ||
1006 | [enable_heapstats=1], | ||
1007 | [enable_heapstats=0]) | ||
1008 | AC_MSG_RESULT($enable_heapstats) | ||
1009 | AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS],$enable_heapstats,[enable expensive heap statistics]) | ||
1010 | |||
1002 | # should code be enabled that works around missing OS functionality on Windows? | 1011 | # should code be enabled that works around missing OS functionality on Windows? |
1003 | # used for test cases | 1012 | # used for test cases |
1004 | if test $build_target = "mingw" | 1013 | if test $build_target = "mingw" |
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index 79d9604c7..0f4149ead 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -271,6 +271,7 @@ struct GNUNET_STATISTICS_Handle | |||
271 | static void | 271 | static void |
272 | update_memory_statistics (struct GNUNET_STATISTICS_Handle *h) | 272 | update_memory_statistics (struct GNUNET_STATISTICS_Handle *h) |
273 | { | 273 | { |
274 | #if ENABLE_HEAP_STATISTICS | ||
274 | uint64_t current_heap_size = 0; | 275 | uint64_t current_heap_size = 0; |
275 | uint64_t current_rss = 0; | 276 | uint64_t current_rss = 0; |
276 | 277 | ||
@@ -304,6 +305,7 @@ update_memory_statistics (struct GNUNET_STATISTICS_Handle *h) | |||
304 | h->peak_rss = current_rss; | 305 | h->peak_rss = current_rss; |
305 | GNUNET_STATISTICS_set (h, "# peak resident set size", current_rss, GNUNET_NO); | 306 | GNUNET_STATISTICS_set (h, "# peak resident set size", current_rss, GNUNET_NO); |
306 | } | 307 | } |
308 | #endif | ||
307 | } | 309 | } |
308 | 310 | ||
309 | 311 | ||