summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-16 17:15:52 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-16 17:15:52 -0400
commitbc2983928dc8f98051321846d8c8fa374c8181b6 (patch)
tree0583aa92ab796ba6c4167618ff1f757e58c9e174 /src
parent5e1870e259e866f3720bddbf757dec0c781cc967 (diff)
downloadfork-ledger-bc2983928dc8f98051321846d8c8fa374c8181b6.tar.gz
fork-ledger-bc2983928dc8f98051321846d8c8fa374c8181b6.tar.bz2
fork-ledger-bc2983928dc8f98051321846d8c8fa374c8181b6.zip
Compilation verification code only with debugging
Previously, --verify would work even if the sources were built with default options. However, in the interests of performance, --verify is now only available if --enable-debug was passed to configure.
Diffstat (limited to 'src')
-rw-r--r--src/main.cc4
-rw-r--r--src/utils.cc2
-rw-r--r--src/utils.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc
index 26f3fe31..58b3f169 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -62,7 +62,9 @@ int main(int argc, char * argv[], char * envp[])
// --debug CATEGORY ; turns on debug logging
// --trace LEVEL ; turns on trace logging
handle_debug_options(argc, argv);
+#if defined(VERIFY_ON)
IF_VERIFY() initialize_memory_tracing();
+#endif
INFO("Ledger starting");
@@ -193,7 +195,9 @@ int main(int argc, char * argv[], char * envp[])
global_scope.reset();
INFO("Ledger ended (Boost/libstdc++ may still hold memory)");
+#if defined(VERIFY_ON)
shutdown_memory_tracing();
+#endif
} else {
// Don't free anything, just let it all leak.
global_scope.release();
diff --git a/src/utils.cc b/src/utils.cc
index d20d585a..d42ed79c 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -463,12 +463,14 @@ bool logger_func(log_level_t level)
*_log_stream << std::right << std::setw(5)
<< (CURRENT_TIME() - logger_start).total_milliseconds() << "ms";
+#if defined(VERIFY_ON)
IF_VERIFY() {
*_log_stream << std::right << std::setw(6) << std::setprecision(3);
stream_memory_size(*_log_stream, current_objects_size());
*_log_stream << std::right << std::setw(6) << std::setprecision(3);
stream_memory_size(*_log_stream, current_memory_size());
}
+#endif
*_log_stream << " " << std::left << std::setw(7);
diff --git a/src/utils.h b/src/utils.h
index 93cb9a4a..4beff305 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -60,7 +60,6 @@
#define NO_ASSERTS 1
#define NO_LOGGING 1
#else
-#define VERIFY_ON 1 // compiled in, use --verify to enable
#define TRACING_ON 1 // use --trace X to enable
#define TIMERS_ON 1
#endif