beautify bench

This commit is contained in:
Michel van Kessel
2020-12-17 14:21:06 +01:00
parent 21b81d1d59
commit e4281a84bc
11 changed files with 41 additions and 44 deletions

View File

@@ -1 +1,2 @@
bench_bitcoin
bench_blackmore
bench_bitcoin

View File

@@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include "main.h"
#include "utiltime.h"
#include <bench/bench.h>
#include <main.h>
#include <utiltime.h>
// Sanity test: this should loop ten times, and
// min/max/average should be close to 100ms.

View File

@@ -2,10 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include <bench/bench.h>
#include "main.h"
#include "base58.h"
#include <main.h>
#include <base58.h>
#include <vector>
#include <string>

View File

@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include <bench/bench.h>
#include <iostream>
#include <iomanip>
@@ -14,7 +14,7 @@ std::map<std::string, BenchFunction> BenchRunner::benchmarks;
static double gettimedouble(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
gettimeofday(&tv, nullptr);
return tv.tv_usec * 0.000001 + tv.tv_sec;
}
@@ -64,11 +64,8 @@ bool State::KeepRunning()
return true;
}
if (elapsed*16 < maxElapsed) {
uint64_t newCountMask = ((countMask<<1)|1) & ((1LL<<60)-1);
if ((count & newCountMask)==0) {
countMask = newCountMask;
countMaskInv = 1./(countMask+1);
}
countMask = ((countMask<<1)|1) & ((1LL<<60)-1);
countMaskInv = 1./(countMask+1);
}
}
lastTime = now;

View File

@@ -2,11 +2,11 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include <bench/bench.h>
#include "key.h"
#include "main.h"
#include "util.h"
#include <key.h>
#include <main.h>
#include <util.h>
int
main(int argc, char** argv)

View File

@@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "cashaddr.h"
#include "bench.h"
#include <cashaddr.h>
#include <bench/bench.h>
#include <string>
#include <vector>
@@ -29,4 +29,4 @@ static void CashAddrDecode(benchmark::State &state) {
}
BENCHMARK(CashAddrEncode);
BENCHMARK(CashAddrDecode);
BENCHMARK(CashAddrDecode);

View File

@@ -2,10 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include "coins.h"
#include "policy/policy.h"
#include "wallet/crypter.h"
#include <bench/bench.h>
#include <coins.h>
#include <policy/policy.h>
#include <wallet/crypter.h>
#include <vector>

View File

@@ -2,10 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include "wallet/wallet.h"
#include <bench/bench.h>
#include <wallet/wallet.h>
#include <boost/foreach.hpp>
#include <set>
using namespace std;
@@ -41,7 +40,7 @@ static void CoinSelection(benchmark::State& state)
while (state.KeepRunning()) {
// Empty wallet.
BOOST_FOREACH (COutput output, vCoins)
for(COutput output: vCoins)
delete output.tx;
vCoins.clear();

View File

@@ -4,15 +4,15 @@
#include <iostream>
#include "bench.h"
#include "bloom.h"
#include "hash.h"
#include "uint256.h"
#include "utiltime.h"
#include "crypto/ripemd160.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
#include "crypto/sha512.h"
#include <bench/bench.h>
#include <bloom.h>
#include <hash.h>
#include <uint256.h>
#include <utiltime.h>
#include <crypto/ripemd160.h>
#include <crypto/sha1.h>
#include <crypto/sha256.h>
#include <crypto/sha512.h>
/* Number of bytes to hash per iteration */
static const uint64_t BUFFER_SIZE = 1000*1000;

View File

@@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bench.h"
#include "policy/policy.h"
#include "txmempool.h"
#include <bench/bench.h>
#include <policy/policy.h>
#include <txmempool.h>
#include <list>
#include <vector>

View File

@@ -4,9 +4,9 @@
#include <iostream>
#include "bench.h"
#include "bloom.h"
#include "utiltime.h"
#include <bench/bench.h>
#include <bloom.h>
#include <utiltime.h>
static void RollingBloom(benchmark::State& state)
{