| 94 | } |
| 95 | |
| 96 | static void MemPoolAddTransactions(benchmark::Bench& bench) |
| 97 | { |
| 98 | FastRandomContext det_rand{true}; |
| 99 | int childTxs = 50; |
| 100 | if (bench.complexityN() > 1) { |
| 101 | childTxs = static_cast<int>(bench.complexityN()); |
| 102 | } |
| 103 | const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(ChainType::MAIN); |
| 104 | CTxMemPool& pool = *testing_setup.get()->m_node.mempool; |
| 105 | |
| 106 | std::vector<CTransactionRef> transactions; |
| 107 | // Create 1000 clusters of 100 transactions each |
| 108 | for (int i=0; i<100; i++) { |
| 109 | auto new_txs = CreateCoinCluster(det_rand, childTxs, /*min_ancestors=*/ 1); |
| 110 | transactions.insert(transactions.end(), new_txs.begin(), new_txs.end()); |
| 111 | } |
| 112 | |
| 113 | LOCK2(cs_main, pool.cs); |
| 114 | |
| 115 | bench.run([&]() NO_THREAD_SAFETY_ANALYSIS { |
| 116 | for (auto& tx : transactions) { |
| 117 | AddTx(tx, pool, det_rand); |
| 118 | } |
| 119 | pool.TrimToSize(0, nullptr); |
| 120 | }); |
| 121 | } |
| 122 | |
| 123 | static void ComplexMemPool(benchmark::Bench& bench) |
| 124 | { |
nothing calls this directly
no test coverage detected