1 // Copyright (c) 2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 #include "support/lockedpool.h"
16 static void BenchLockedPool(benchmark::State
& state
)
18 void *synth_base
= reinterpret_cast<void*>(0x08000000);
19 const size_t synth_size
= 1024*1024;
20 Arena
b(synth_base
, synth_size
, 16);
22 std::vector
<void*> addr
;
23 for (int x
=0; x
<ASIZE
; ++x
)
25 uint32_t s
= 0x12345678;
26 while (state
.KeepRunning()) {
27 for (int x
=0; x
<BITER
; ++x
) {
28 int idx
= s
& (addr
.size()-1);
32 } else if(!addr
[idx
]) {
33 addr
[idx
] = b
.alloc((s
>> 16) & (MSIZE
-1));
38 s
^= 0xf00f00f0; // LFSR period 0xf7ffffe0
46 BENCHMARK(BenchLockedPool
);