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

Function normalize_hit_rate

src/test/cuckoocache_tests.cpp:101–104  ·  view source on GitHub ↗

The normalized hit rate for a given load. * * The semantics are a little confusing, so please see the below * explanation. * * Examples: * * 1. at load 0.5, we expect a perfect hit rate, so we multiply by * 1.0 * 2. at load 2.0, we expect to see half the entries, so a perfect hit rate * would be 0.5. Therefore, if we see a hit rate of 0.4, 0.4*2.0 = 0.8 is the * normalized hit rate. *

Source from the content-addressed store, hash-verified

99 * becomes effectively perfect, ignoring freshness.
100 */
101static double normalize_hit_rate(double hits, double load)
102{
103 return hits * std::max(load, 1.0);
104}
105
106/** Check the hit rate on loads ranging from 0.1 to 1.6 */
107BOOST_AUTO_TEST_CASE(cuckoocache_hit_rate_ok)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected