Skip to content

Commit

Permalink
Log debug build status and warn when running benchmarks
Browse files Browse the repository at this point in the history
Summary:
"34328b4 Use PACKAGE_NAME instead of hardcoding application name in log message (Wladimir J. van der Laan)
0c74e2e Log debug build status and warn when running benchmarks (Wladimir J. van der Laan)

Pull request description:

  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."

This is a backport from Core PR12197: bitcoin/bitcoin#12197

Test Plan:
  cmake .. -DCMAKE_BUILD_TYPE=Debug -GNinja
  ninja check
  ninja bench-bitcoin

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, nakihito, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, nakihito, Fabien

Subscribers: Fabien, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4687
  • Loading branch information
laanwj authored and majcosta committed Dec 10, 2019
1 parent bb10be3 commit 81c6819
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ void benchmark::BenchRunner::RunAll(Printer &printer, uint64_t num_evals,
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;
Expand Down
8 changes: 7 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,13 @@ void InitLogging() {

fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS);

LogPrintf("%s version %s\n", CLIENT_NAME, FormatFullVersion());
std::string version_string = FormatFullVersion();
#ifdef DEBUG
version_string += " (debug build)";
#else
version_string += " (release build)";
#endif
LogPrintf("%s version %s\n", CLIENT_NAME, version_string);
}

namespace { // Variables internal to initialization process only
Expand Down

0 comments on commit 81c6819

Please sign in to comment.