MCPcopy Create free account
hub / github.com/apache/trafficserver / get_zipf

Function get_zipf

src/iocore/cache/CacheTest.cc:534–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534static int
535get_zipf(double v)
536{
537 int l = 0, r = ZIPF_SIZE - 1, m;
538 do {
539 m = (r + l) / 2;
540 if (v < zipf_table[m]) {
541 r = m - 1;
542 } else {
543 l = m + 1;
544 }
545 } while (l < r);
546 if (zipf_bucket_size == 1) {
547 return m;
548 }
549 double x = zipf_table[m], y = zipf_table[m + 1];
550 m += static_cast<int>((v - x) / (y - x));
551 return m;
552}
553
554static bool
555test_RamCache(RegressionTest *t, RamCache *cache, const char *name, int64_t cache_size)

Callers 1

test_RamCacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected