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

Method block_activity

src/test/cuckoocache_tests.cpp:303–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301 struct block_activity {
302 std::vector<uint256> reads;
303 block_activity(uint32_t n_insert, Cache& c) : reads()
304 {
305 std::vector<uint256> inserts;
306 inserts.resize(n_insert);
307 reads.reserve(n_insert / 2);
308 for (uint32_t i = 0; i < n_insert; ++i) {
309 uint32_t* ptr = (uint32_t*)inserts[i].begin();
310 for (uint8_t j = 0; j < 8; ++j)
311 *(ptr++) = InsecureRand32();
312 }
313 for (uint32_t i = 0; i < n_insert / 4; ++i)
314 reads.push_back(inserts[i]);
315 for (uint32_t i = n_insert - (n_insert / 4); i < n_insert; ++i)
316 reads.push_back(inserts[i]);
317 for (const auto& h : inserts)
318 c.insert(h);
319 }
320 };
321
322 const uint32_t BLOCK_SIZE = 1000;

Callers

nothing calls this directly

Calls 6

InsecureRand32Function · 0.85
resizeMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected