From 0c74e2e89011053607327d8308025b6f952a3248 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Jan 2018 11:48:33 +0100 Subject: [PATCH 1/2] Log debug build status and warn when running benchmarks Log whether the starting instance of bitcoin core is a debug or release build (--enable-debug). Also warn when running the benchmarks with a debug build, to prevent mistakes comparing debug to non-debug results. --- src/bench/bench.cpp | 3 +++ src/init.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index dd120f359..21329a515 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -100,6 +100,9 @@ void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double if (!std::ratio_less_equal::value) { std::cerr << "WARNING: Clock precision is worse than microsecond - benchmarks may be less accurate!\n"; } +#ifdef DEBUG + std::cerr << "WARNING: This is a debug build - may result in slower benchmarks.\n"; +#endif std::regex reFilter(filter); std::smatch baseMatch; diff --git a/src/init.cpp b/src/init.cpp index b48802637..7abd0c9ba 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -808,7 +808,13 @@ void InitLogging() fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - LogPrintf("Bitcoin version %s\n", FormatFullVersion()); + std::string version_string = FormatFullVersion(); +#ifdef DEBUG + version_string += " (debug build)"; +#else + version_string += " (release build)"; +#endif + LogPrintf("Bitcoin version %s\n", version_string); } namespace { // Variables internal to initialization process only From 34328b4980848bca372347c8680b94d9d02eca0a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 18 Jan 2018 19:16:46 +0100 Subject: [PATCH 2/2] Use PACKAGE_NAME instead of hardcoding application name in log message --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 7abd0c9ba..be9614d8a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -814,7 +814,7 @@ void InitLogging() #else version_string += " (release build)"; #endif - LogPrintf("Bitcoin version %s\n", version_string); + LogPrintf(PACKAGE_NAME " version %s\n", version_string); } namespace { // Variables internal to initialization process only