Skip to content
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

Merged
merged 2 commits into from Nov 8, 2017

Conversation

theuni
Copy link
Member

@theuni theuni commented Oct 25, 2017

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.

@practicalswift
Copy link
Contributor

Concept ACK

@maflcko
Copy link
Member

maflcko commented Oct 25, 2017

Concept ACK. This is what the google bench does.

@fanquake
Copy link
Member

master 57ee739

src/bench/bench_bitcoin
#Benchmark,count,min,max,average,min_cycles,max_cycles,average_cycles
Base58CheckEncode,294912,0.000003700712114,0.000003791210474,0.000003750498258,12553,12860,12723
Base58Decode,1048576,0.000000986561645,0.000001043212251,0.000001009610287,3346,3542,3425
Base58Encode,425984,0.000002401517122,0.000002516913810,0.000002463796521,8146,8538,8357
BenchLockedPool,640,0.001663804054260,0.001768421381712,0.001725013926625,5644197,5998992,5852070
CCheckQueueSpeed,512,0.001896254718304,0.002109408378601,0.001992908306420,6432527,7155741,6760920
CCheckQueueSpeedPrevectorJob,448,0.002330623567104,0.002476744353771,0.002359484455415,7906058,8401791,8004012
CCoinsCaching,122880,0.000008048693417,0.000008630100638,0.000008307983323,27303,29275,28184
CoinSelection,576,0.001785077154636,0.001916944980621,0.001805677182145,6055513,6502807,6125742
DeserializeAndCheckBlockTest,112,0.008977383375168,0.009968042373657,0.009116992354393,30453379,33814404,30927281
DeserializeBlockTest,144,0.007569313049316,0.007755517959595,0.007618673973613,25677256,26308849,25846183
FastRandom_1bit,640,0.001670766621828,0.001709744334221,0.001680362224579,5671193,5799963,5700593
FastRandom_32bit,112,0.009404510259628,0.009604752063751,0.009498813322612,31902396,32581996,32222551
MempoolEviction,24576,0.000041037099436,0.000047371606342,0.000042666749020,139209,160698,144746
PrevectorClear,5120,0.000209093093872,0.000216422602534,0.000211418559775,709305,734155,717233
PrevectorDestructor,5120,0.000199727714062,0.000203179195523,0.000201328517869,677510,689255,682960
RIPEMD160,416,0.002455778419971,0.002532064914703,0.002477367910055,8330696,8589435,8404447
RollingBloom-refresh,1,0.000129,0.000129,0.000129
RollingBloom-refresh,1,0.000111,0.000111,0.000111
RollingBloom-refresh,1,0.000129,0.000129,0.000129
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000113,0.000113,0.000113
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000111,0.000111,0.000111
RollingBloom-refresh,1,0.000113,0.000113,0.000113
RollingBloom-refresh,1,0.000111,0.000111,0.000111
RollingBloom-refresh,1,0.000123,0.000123,0.000123
RollingBloom-refresh,1,0.000108,0.000108,0.000108
RollingBloom-refresh,1,0.000127,0.000127,0.000127
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000113,0.000113,0.000113
RollingBloom-refresh,1,0.000111,0.000111,0.000111
RollingBloom-refresh,1,0.000117,0.000117,0.000117
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000109,0.000109,0.000109
RollingBloom-refresh,1,0.00011,0.00011,0.00011
RollingBloom-refresh,1,0.000108,0.000108,0.000108
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.000112,0.000112,0.000112
RollingBloom-refresh,1,0.00011,0.00011,0.00011
RollingBloom-refresh,1,0.000109,0.000109,0.000109
RollingBloom-refresh,1,0.000113,0.000113,0.000113
RollingBloom,1572864,0.000000646410626,0.000000685669875,0.000000676037568,2192,2327,2293
SHA1,576,0.001821309328079,0.001895938068628,0.001866892394092,6178301,6431563,6333002
SHA256,352,0.002996556460857,0.003085255622864,0.003031289712949,10165221,10466029,10283598
SHA256_32b,6,0.215636968612671,0.217754483222961,0.216444651285807,731612744,738682787,734277071
SHA512,384,0.002636194229126,0.002715311944485,0.002677739908298,8942669,9211179,9083624
SipHash_32b,28,0.036945462226868,0.039195537567139,0.037574112415314,125329483,132961911,127469598
Sleep100ms,10,0.102285981178284,0.104399442672729,0.102977490425110,347096871,354150647,349350507
Trig,67108864,0.000000015336752,0.000000016048432,0.000000015816315,52,54,53
VerifyScriptBench,6144,0.000164830125868,0.000173246022314,0.000169373194998,559145,587697,574596

This PR e2dc48c

src/bench/bench_bitcoin
#Benchmark,count,min,max,average,min_cycles,max_cycles,average_cycles. Clock precision: nanosecond
Base58CheckEncode,262144,3873ns,4485ns,4025ns,13138,15215,13655
Base58Decode,983040,1022ns,1089ns,1042ns,3467,3694,3536
Base58Encode,393216,2509ns,2694ns,2568ns,8511,9140,8712
BenchLockedPool,576,1711427ns,1831078ns,1761460ns,5805626,6211513,5975351
CCheckQueueSpeed,576,1894807ns,1987571ns,1943943ns,6427702,6742379,6594382
CCheckQueueSpeedPrevectorJob,416,2375311ns,2435702ns,2410998ns,8057696,8262562,8178757
CCoinsCaching,122880,8041ns,8954ns,8476ns,27277,30374,28754
CoinSelection,576,1883259ns,1920119ns,1896561ns,6388520,6513567,6433648
DeserializeAndCheckBlockTest,112,9069196ns,10666107ns,9416574ns,30765154,36182297,31943563
DeserializeBlockTest,128,7655800ns,8043978ns,7823370ns,25970543,27287306,26538987
FastRandom_1bit,640,1677213ns,1759200ns,1725739ns,5689570,5967687,5854173
FastRandom_32bit,104,9361699ns,10403821ns,9620188ns,31757436,35292568,32634282
MempoolEviction,24576,41403ns,43570ns,42427ns,140452,147802,143927
PrevectorClear,5120,208818ns,234129ns,215746ns,708367,794231,731869
PrevectorDestructor,4608,217063ns,228702ns,221567ns,736337,775821,751618
RIPEMD160,416,2491869ns,2678229ns,2566195ns,8453095,9085277,8705227
RollingBloom-refresh,1,112950,112950,112950
RollingBloom-refresh,1,109470,109470,109470
RollingBloom-refresh,1,119208,119208,119208
RollingBloom-refresh,1,108423,108423,108423
RollingBloom-refresh,1,110924,110924,110924
RollingBloom-refresh,1,107718,107718,107718
RollingBloom-refresh,1,104799,104799,104799
RollingBloom-refresh,1,107850,107850,107850
RollingBloom-refresh,1,236540,236540,236540
RollingBloom-refresh,1,110421,110421,110421
RollingBloom-refresh,1,107586,107586,107586
RollingBloom-refresh,1,105012,105012,105012
RollingBloom-refresh,1,135634,135634,135634
RollingBloom-refresh,1,121365,121365,121365
RollingBloom-refresh,1,105733,105733,105733
RollingBloom-refresh,1,107545,107545,107545
RollingBloom-refresh,1,107570,107570,107570
RollingBloom-refresh,1,113778,113778,113778
RollingBloom-refresh,1,112316,112316,112316
RollingBloom-refresh,1,107881,107881,107881
RollingBloom-refresh,1,108146,108146,108146
RollingBloom-refresh,1,107903,107903,107903
RollingBloom-refresh,1,110589,110589,110589
RollingBloom-refresh,1,107555,107555,107555
RollingBloom,1441792,679ns,742ns,711ns,2305,2518,2414
SHA1,576,1845302ns,1918492ns,1887662ns,6259766,6508049,6403460
SHA256,352,3038257ns,3252807ns,3120301ns,10306589,11034401,10584908
SHA256_32b,6,220640728ns,226463297ns,222662923ns,748472847,768224917,755332837
SHA512,384,2663500ns,3062115ns,2776882ns,9035312,10387520,9419936
SipHash_32b,28,36830074ns,39666791ns,38085206ns,124937632,134560472,129195322
Sleep100ms,10,101757668ns,103232076ns,102764599ns,345189224,350191554,348605289
Trig,67108864,15ns,16ns,15ns,52,57,53
VerifyScriptBench,6144,166119ns,174340ns,169195ns,563523,591412,573955

@laanwj
Copy link
Member

laanwj commented Oct 26, 2017

Does this also use a monotonic clock? That's another issue with using plain gettimeofday for benchmarks.

@theuni
Copy link
Member Author

theuni commented Oct 26, 2017

@laanwj Yes, if the resolution is no worse than the high precision clock. See the last commit: e2dc48c

@laanwj
Copy link
Member

laanwj commented Oct 26, 2017

@laanwj Yes, if the resolution is no worse than the high precision clock. See the last commit: e2dc48c

Nice! concept ACK

@martinus
Copy link
Contributor

I've also switched to std::chrono in #11517

{
perf_init();
std::cout << "#Benchmark" << "," << "count" << "," << "min" << "," << "max" << "," << "average" << ","
<< "min_cycles" << "," << "max_cycles" << "," << "average_cycles" << "\n";
<< "min_cycles" << "," << "max_cycles" << "," << "average_cycles. " << "Clock precision: "
Copy link
Member

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.

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,"
Copy link
Member

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

@laanwj
Copy link
Member

laanwj commented Nov 6, 2017

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.
@theuni
Copy link
Member Author

theuni commented Nov 7, 2017

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.

@laanwj laanwj merged commit 24a0bdd into bitcoin:master Nov 8, 2017
laanwj added a commit that referenced this pull request Nov 8, 2017
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
@maflcko
Copy link
Member

maflcko commented Nov 9, 2017

post merge utACK 24a0bdd

Looks like a clear improvement.

@TheBlueMatt
Copy link
Contributor

Postumous utACK 24a0bdd modulo changes in #11646.

laanwj added a commit that referenced this pull request Dec 13, 2017
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
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Aug 13, 2018
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 18, 2019
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
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
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
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
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
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
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
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
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 16, 2020
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
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jan 16, 2020
zkbot added a commit to zcash/zcash that referenced this pull request Jan 24, 2020
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.
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 4, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 9, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 13, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
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
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Jun 8, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 26, 2021
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
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 26, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
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
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 30, 2021
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
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Jul 29, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants