Changeset View
Changeset View
Standalone View
Standalone View
src/bench/mempool_eviction.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <bench/bench.h> | #include <bench/bench.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <list> | #include <list> | ||||
#include <vector> | #include <vector> | ||||
static void AddTx(const CTransactionRef &tx, const Amount &nFee, | static void AddTx(const CTransactionRef &tx, const Amount &nFee, | ||||
CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs) { | CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs) { | ||||
int64_t nTime = 0; | int64_t nTime = 0; | ||||
double dPriority = 10.0; | |||||
unsigned int nHeight = 1; | unsigned int nHeight = 1; | ||||
bool spendsCoinbase = false; | bool spendsCoinbase = false; | ||||
unsigned int sigOpCost = 4; | unsigned int sigOpCost = 4; | ||||
LockPoints lp; | LockPoints lp; | ||||
pool.addUnchecked(tx->GetId(), | pool.addUnchecked(tx->GetId(), | ||||
CTxMemPoolEntry(tx, nFee, nTime, dPriority, nHeight, | CTxMemPoolEntry(tx, nFee, nTime, nHeight, spendsCoinbase, | ||||
tx->GetValueOut(), spendsCoinbase, | |||||
sigOpCost, lp)); | sigOpCost, lp)); | ||||
} | } | ||||
// Right now this is only testing eviction performance in an extremely small | // Right now this is only testing eviction performance in an extremely small | ||||
// mempool. Code needs to be written to generate a much wider variety of | // mempool. Code needs to be written to generate a much wider variety of | ||||
// unique transactions for a more meaningful performance measurement. | // unique transactions for a more meaningful performance measurement. | ||||
static void MempoolEviction(benchmark::State &state) { | static void MempoolEviction(benchmark::State &state) { | ||||
CMutableTransaction tx1 = CMutableTransaction(); | CMutableTransaction tx1 = CMutableTransaction(); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |