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) { | CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs) { | ||||
int64_t nTime = 0; | int64_t nTime = 0; | ||||
double dPriority = 10.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, dPriority, nHeight, | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | static void MempoolEviction(benchmark::State &state) { | ||||
tx7.vin[1].scriptSig = CScript() << OP_6; | tx7.vin[1].scriptSig = CScript() << OP_6; | ||||
tx7.vout.resize(2); | tx7.vout.resize(2); | ||||
tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | ||||
tx7.vout[0].nValue = 10 * COIN; | tx7.vout[0].nValue = 10 * COIN; | ||||
tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; | ||||
tx7.vout[1].nValue = 10 * COIN; | tx7.vout[1].nValue = 10 * COIN; | ||||
CTxMemPool pool; | CTxMemPool pool; | ||||
LOCK(pool.cs); | |||||
// Create transaction references outside the "hot loop" | // Create transaction references outside the "hot loop" | ||||
const CTransactionRef tx1_r{MakeTransactionRef(tx1)}; | const CTransactionRef tx1_r{MakeTransactionRef(tx1)}; | ||||
const CTransactionRef tx2_r{MakeTransactionRef(tx2)}; | const CTransactionRef tx2_r{MakeTransactionRef(tx2)}; | ||||
const CTransactionRef tx3_r{MakeTransactionRef(tx3)}; | const CTransactionRef tx3_r{MakeTransactionRef(tx3)}; | ||||
const CTransactionRef tx4_r{MakeTransactionRef(tx4)}; | const CTransactionRef tx4_r{MakeTransactionRef(tx4)}; | ||||
const CTransactionRef tx5_r{MakeTransactionRef(tx5)}; | const CTransactionRef tx5_r{MakeTransactionRef(tx5)}; | ||||
const CTransactionRef tx6_r{MakeTransactionRef(tx6)}; | const CTransactionRef tx6_r{MakeTransactionRef(tx6)}; | ||||
const CTransactionRef tx7_r{MakeTransactionRef(tx7)}; | const CTransactionRef tx7_r{MakeTransactionRef(tx7)}; | ||||
Show All 15 Lines |