Bitcoin Core 28.99.0
P2P Digital Currency
|
Public Member Functions | |
template<typename Cache > | |
double | test_cache (size_t megabytes, double load) |
This helper returns the hit rate when megabytes*load worth of entries are inserted into a megabytes sized cache. More... | |
Public Member Functions inherited from BasicTestingSetup | |
void | SeedRandomForTest (SeedRand seed) |
Seed the global RNG state and m_rng for testing and log the seed value. More... | |
BasicTestingSetup (const ChainType chainType=ChainType::MAIN, TestOpts={}) | |
~BasicTestingSetup () | |
Static Public Member Functions | |
static double | normalize_hit_rate (double hits, double load) |
The normalized hit rate for a given load. More... | |
Additional Inherited Members | |
Public Attributes inherited from BasicTestingSetup | |
util::SignalInterrupt | m_interrupt |
node::NodeContext | m_node |
FastRandomContext | m_rng |
fs::path | m_path_root |
fs::path | m_path_lock |
bool | m_has_custom_datadir {false} |
ArgsManager | m_args |
Test-specific arguments and settings. More... | |
Definition at line 52 of file cuckoocache_tests.cpp.
|
inlinestatic |
The normalized hit rate for a given load.
The semantics are a little confusing, so please see the below explanation.
Examples:
This is basically the right semantics, but has a bit of a glitch depending on how you measure around load 1.0 as after load 1.0 your normalized hit rate becomes effectively perfect, ignoring freshness.
Definition at line 104 of file cuckoocache_tests.cpp.
|
inline |
This helper returns the hit rate when megabytes*load worth of entries are inserted into a megabytes sized cache.
We make a copy of the hashes because future optimizations of the cuckoocache may overwrite the inserted element, so the test is "future proofed".
Do the insert
Count the hits
Definition at line 57 of file cuckoocache_tests.cpp.