MCPcopy Create free account
hub / github.com/ElementsProject/elements / ComplexMemPool

Function ComplexMemPool

src/bench/mempool_stress.cpp:85–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static void ComplexMemPool(benchmark::Bench& bench)
86{
87 FastRandomContext det_rand{true};
88 int childTxs = 800;
89 if (bench.complexityN() > 1) {
90 childTxs = static_cast<int>(bench.complexityN());
91 }
92 std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 1);
93 const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN);
94 CTxMemPool pool;
95 LOCK2(cs_main, pool.cs);
96 bench.run([&]() NO_THREAD_SAFETY_ANALYSIS {
97 for (auto& tx : ordered_coins) {
98 AddTx(tx, pool);
99 }
100 pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4);
101 pool.TrimToSize(GetVirtualTransactionSize(*ordered_coins.front()));
102 });
103}
104
105static void MempoolCheck(benchmark::Bench& bench)
106{

Callers

nothing calls this directly

Calls 7

CreateOrderedCoinsFunction · 0.85
AddTxFunction · 0.85
complexityNMethod · 0.80
TrimToSizeMethod · 0.80
runMethod · 0.45
DynamicMemoryUsageMethod · 0.45

Tested by

no test coverage detected