summaryrefslogtreecommitdiff
path: root/src/mongo/unittest
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2018-03-20 17:33:01 -0400
committerRobert Guo <robert.guo@10gen.com>2018-03-29 10:28:35 -0400
commit29bd1eb185a983703bc6d02e7e4c5c3ebd96e6cb (patch)
tree56180cc6cec534c15e1bd77fead956cb64d66a22 /src/mongo/unittest
parentabc831b3b8c91b2f1d47777abcb8d205a987e036 (diff)
downloadmongo-29bd1eb185a983703bc6d02e7e4c5c3ebd96e6cb.tar.gz
SERVER-33621 Warn if benchmark is not compiled with --opt=on
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r--src/mongo/unittest/benchmark_main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/unittest/benchmark_main.cpp b/src/mongo/unittest/benchmark_main.cpp
index b714ace268a..119968e8370 100644
--- a/src/mongo/unittest/benchmark_main.cpp
+++ b/src/mongo/unittest/benchmark_main.cpp
@@ -35,6 +35,7 @@
#include "mongo/base/initializer.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_context_registrar.h"
+#include "mongo/util/log.h"
#include "mongo/util/signal_handlers_synchronous.h"
@@ -53,5 +54,12 @@ int main(int argc, char** argv, char** envp) {
::benchmark::Initialize(&argc, argv);
if (::benchmark::ReportUnrecognizedArguments(argc, argv))
return 1;
+
+#ifndef MONGO_CONFIG_OPTIMIZED_BUILD
+ ::mongo::log() << "***WARNING*** MongoDB was built with --opt=off. Function timings may be "
+ "affected. Always verify any code change against the production environment "
+ "(e.g. --opt=on).";
+#endif
+
::benchmark::RunSpecifiedBenchmarks();
}