Changeset View
Changeset View
Standalone View
Standalone View
src/test/cuckoocache_tests.cpp
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
* This is basically the right semantics, but has a bit of a glitch depending on | * 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 | * how you measure around load 1.0 as after load 1.0 your normalized hit rate | ||||
* becomes effectively perfect, ignoring freshness. | * becomes effectively perfect, ignoring freshness. | ||||
*/ | */ | ||||
static double normalize_hit_rate(double hits, double load) { | static double normalize_hit_rate(double hits, double load) { | ||||
return hits * std::max(load, 1.0); | return hits * std::max(load, 1.0); | ||||
} | } | ||||
/** Check the hit rate on loads ranging from 0.1 to 2.0 */ | /** Check the hit rate on loads ranging from 0.1 to 1.6 */ | ||||
BOOST_AUTO_TEST_CASE(cuckoocache_hit_rate_ok) { | BOOST_AUTO_TEST_CASE(cuckoocache_hit_rate_ok) { | ||||
/** | /** | ||||
* Arbitrarily selected Hit Rate threshold that happens to work for this | * Arbitrarily selected Hit Rate threshold that happens to work for this | ||||
* test as a lower bound on performance. | * test as a lower bound on performance. | ||||
*/ | */ | ||||
double HitRateThresh = 0.98; | double HitRateThresh = 0.98; | ||||
size_t megabytes = 4; | size_t megabytes = 4; | ||||
for (double load = 0.1; load < 2; load *= 2) { | for (double load = 0.1; load < 2; load *= 2) { | ||||
▲ Show 20 Lines • Show All 330 Lines • Show Last 20 Lines |