New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bench: use std::chrono rather than gettimeofday #11562
Conversation
Concept ACK |
Concept ACK. This is what the google bench does. |
master 57ee739
This PR e2dc48c
|
Does this also use a monotonic clock? That's another issue with using plain gettimeofday for benchmarks. |
Nice! concept ACK |
I've also switched to std::chrono in #11517 |
src/bench/bench.cpp
Outdated
{ | ||
perf_init(); | ||
std::cout << "#Benchmark" << "," << "count" << "," << "min" << "," << "max" << "," << "average" << "," | ||
<< "min_cycles" << "," << "max_cycles" << "," << "average_cycles" << "\n"; | ||
<< "min_cycles" << "," << "max_cycles" << "," << "average_cycles. " << "Clock precision: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a ,
, to separate here, instead of a dot, otherwise programs will get confused re: CSV parsing.
src/bench/bench.cpp
Outdated
int64_t averageCycles = (nowCycles-beginCycles)/count; | ||
std::cout << std::fixed << std::setprecision(15) << name << "," << count << "," << minTime << "," << maxTime << "," << average << "," | ||
std::cout << std::fixed << std::setprecision(15) << name << "," << count << "," << min_elapsed << "ns," << max_elapsed << "ns," << avg_elapsed << "ns," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the unit id in the row header, not in the data. Adding it to every record complicates parsing (for example, spreadsheets won't see it as number anymore, and will not be able to compute with it or plot it).
utACK apart from output format nits. |
std::chrono removes portability issues. Rather than storing doubles, store the untouched time_points. Then convert to nanoseconds for display. This allows for maximum precision, while keeping results comparable between differing hardware/operating systems. Also, display full nanosecond counts rather than sub-second floats.
e2dc48c
to
24a0bdd
Compare
Fixed up formatting as @laanwj suggested. I just dropped the commit which added the clock precision display, as there's no obvious (to me) way to show it without breaking csv. |
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example #11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
post merge utACK 24a0bdd Looks like a clear improvement. |
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson) Pull request description: These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (#11562 is also required). I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up. Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632 Signed-off-by: Pasta <pasta@dashboost.org> # Conflicts: # src/bench/bench.cpp # src/bench/bench.h
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
…meofday" This reverts commit 6a18c36.
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
…meofday" This reverts commit 6a18c36.
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
…meofday" This reverts commit 6a18c36.
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
…meofday" This reverts commit 6a18c36.
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
…meofday" This reverts commit 6a18c36.
Micro-benchmarking framework part 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6733 - bitcoin/bitcoin#6770 - bitcoin/bitcoin#6892 - Excluding changes to `src/policy/policy.h` which we don't have yet. - bitcoin/bitcoin#7934 - Just the benchmark, not the performance improvements. - bitcoin/bitcoin#8039 - bitcoin/bitcoin#8107 - bitcoin/bitcoin#8115 - bitcoin/bitcoin#8914 - Required resolving several merge conflicts in code that had been refactored upstream. The changes were simple enough that I decided it was okay to impose merge conflicts on pulling in those refactors later. - bitcoin/bitcoin#9200 - bitcoin/bitcoin#9202 - Adds support for measuring CPU cycles, which is later removed in an upstream PR after the refactor. I am including it to reduce future merge conflicts. - bitcoin/bitcoin#9281 - Only changes to `src/bench/bench.cpp` - bitcoin/bitcoin#9498 - bitcoin/bitcoin#9712 - bitcoin/bitcoin#9547 - bitcoin/bitcoin#9505 - Just the benchmark, not the performance improvements. - bitcoin/bitcoin#9792 - Just the benchmark, not the performance improvements. - bitcoin/bitcoin#10272 - bitcoin/bitcoin#10395 - Only changes to `src/bench/` - bitcoin/bitcoin#10735 - Only changes to `src/bench/base58.cpp` - bitcoin/bitcoin#10963 - bitcoin/bitcoin#11303 - Only the benchmark backend change. - bitcoin/bitcoin#11562 - bitcoin/bitcoin#11646 - bitcoin/bitcoin#11654 This pulls in all changes to the micro-benchmark framework prior to December 2017, when it was rewritten. The rewrite depends on other upstream PRs we have not pulled in yet. This does not pull in all benchmarks prior to December 2017. It leaves out benchmarks that either test code we do not have yet (except for the `FastRandomContext` refactor, which I decided to pull in), or would require rewrites to work with our changes to the codebase.
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson) Pull request description: These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required). I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up. Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson) Pull request description: These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required). I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up. Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson) Pull request description: These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required). I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up. Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
3f3edde [Bench] Use PIVX address in Base58Decode test (random-zebra) 5a1be90 [Travis] Disable benchmark framework for trusty test (random-zebra) 1bd89ac Initialize recently introduced non-static class member lastCycles to zero in constructor (random-zebra) ec60671 Require a steady clock for bench with at least micro precision (random-zebra) 84069ce bench: prefer a steady clock if the resolution is no worse (random-zebra) 38367b1 bench: switch to std::chrono for time measurements (random-zebra) a24633a Remove countMaskInv caching in bench framework (random-zebra) 9e9bc22 Restore default format state of cout after printing with std::fixed/setprecision (random-zebra) 3dd559d Avoid static analyzer warnings regarding uninitialized arguments (random-zebra) e85f224 Replace boost::function with std::function (C++11) (random-zebra) 98c0857 Prevent warning: variable 'x' is uninitialized (random-zebra) 7f0d4b3 FastRandom benchmark (random-zebra) d9fa0c6 Add prevector destructor benchmark (random-zebra) e1527ba Assert that what might look like a possible division by zero is actually unreachable (random-zebra) e94cf15 bench: Fix initialization order in registration (random-zebra) 151c25f Basic CCheckQueue Benchmarks (random-zebra) 51aedbc Use std:thread:hardware_concurrency, instead of Boost, to determine available cores (random-zebra) d447613 Use real number of cores for default -par, ignore virtual cores (random-zebra) 9162a56 [Refactoring] Removed using namespace <xxx> from bench/ sources (random-zebra) 5c07f67 bench: Add support for measuring CPU cycles (random-zebra) 41ce1ed bench: Fix subtle counting issue when rescaling iteration count (random-zebra) 68ea794 Avoid integer division in the benchmark inner-most loop. (random-zebra) 3fa4f27 bench: Added base58 encoding/decoding benchmarks (random-zebra) 4442118 bench: Add crypto hash benchmarks (random-zebra) a5179b6 [Trivial] ensure minimal header conventions (random-zebra) 8607d6b Support very-fast-running benchmarks (random-zebra) 4aebb60 Simple benchmarking framework (random-zebra) Pull request description: Introduces the benchmarking framework, loosely based on google's micro-benchmarking library (https://github.com/google/benchmark), ported from Bitcoin, up to 0.16. The benchmark framework is hard-coded to run each benchmark for one wall-clock second, and then spits out .csv-format timing information to stdout. Backported PR: - bitcoin#6733 - bitcoin#6770 - bitcoin#6892 - bitcoin#8039 - bitcoin#8107 - bitcoin#8115 - bitcoin#9200 - bitcoin#9202 - bitcoin#9281 - bitcoin#6361 - bitcoin#10271 - bitcoin#9498 - bitcoin#9712 - bitcoin#9547 - bitcoin#9505 (benchmark only. Rest was in #1557) - bitcoin#9792 (benchmark only. Rest was in #643) - bitcoin#10272 - bitcoin#10395 (base58 only) - bitcoin#10963 - bitcoin#11303 (first commit) - bitcoin#11562 - bitcoin#11646 - bitcoin#11654 Current output of `src/bench/bench_pivx`: ``` #Benchmark,count,min(ns),max(ns),average(ns),min_cycles,max_cycles,average_cycles Base58CheckEncode,131072,7697,8065,7785,20015,20971,20242 Base58Decode,294912,3305,3537,3454,8595,9198,8981 Base58Encode,180224,5498,6020,5767,14297,15652,14994 CCheckQueueSpeed,320,3159960,3535173,3352787,8216030,9191602,8717388 CCheckQueueSpeedPrevectorJob,96,9184484,11410840,10823070,23880046,29668680,28140445 FastRandom_1bit,320,3143690,4838162,3199156,8173726,12579373,8317941 FastRandom_32bit,60,17097612,17923669,17367440,44454504,46602306,45156079 PrevectorClear,3072,334741,366618,346731,870340,953224,901516 PrevectorDestructor,2816,344233,368912,357281,895022,959187,928948 RIPEMD160,288,3404503,3693917,3577774,8851850,9604334,9302363 SHA1,384,2718128,2891558,2802513,7067238,7518184,7286652 SHA256,176,6133760,6580005,6239866,15948035,17108376,16223916 SHA512,240,4251468,4358706,4313463,11054006,11332826,11215186 Sleep100ms,10,100221470,100302411,100239073,260580075,260790726,260625870 ``` NOTE: Not all the tests have been pulled yet (as we might not have the code being tested, or it would require rewrites to work with our different code base), but the framework is updated to December 2017. ACKs for top commit: Fuzzbawls: ACK 3f3edde Tree-SHA512: c283311a9accf6d2feeb93b185afa08589ebef3f18b6e86980dbc3647b9845f75ac9ecce2f1b08738d25ceac36596a2c89d41e4dbf3b463502aa695611aa1f8e
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields) c515d26 bench: switch to std::chrono for time measurements (Cory Fields) Pull request description: gettimeofday has portability issues, see for example bitcoin#11558. Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself. Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead. Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson) Pull request description: These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required). I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up. Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson) Pull request description: This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit. ~~Caveats:~~ - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~. - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~ **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are: - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager) - git clone https://github.com/Microsoft/vcpkg - .\bootstrap-vcpkg.bat - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install - Install the required packages (replace x86 with x64 as required): - vcpkg install boost:x86-windows-static - vcpkg install libevent:x86-windows-static - vcpkg install openssl:x86-windows-static - vcpkg install zeromq:x86-windows-static - vcpkg install berkeleydb:x86-windows-static - vcpkg install secp256k1:x86-windows-static - vcpkg install leveldb:x86-windows-static - git clone https://github.com/bitcoin/bitcoin.git - git checkout -b testbuild - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~ - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~ - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~ - ~~git pull origin pull/13031/head # gmtime fix for msvc~~ - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment. Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
gettimeofday has portability issues, see for example #11558.
Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.
Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.