MCPcopy Create free account
hub / github.com/bytedance/bolt / updateStats

Method updateStats

bolt/common/caching/AsyncDataCache.cpp:528–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528void CacheShard::updateStats(CacheStats& stats) {
529 std::lock_guard<std::mutex> l(mutex_);
530 for (auto& entry : entries_) {
531 if (!entry || !entry->key_.fileNum.hasValue()) {
532 ++stats.numEmptyEntries;
533 continue;
534 } else if (entry->isExclusive()) {
535 stats.exclusivePinnedBytes +=
536 entry->data().byteSize() + entry->tinyData_.capacity();
537 ++stats.numExclusive;
538 } else if (entry->isShared()) {
539 stats.sharedPinnedBytes +=
540 entry->data().byteSize() + entry->tinyData_.capacity();
541 ++stats.numShared;
542 }
543 if (entry->isPrefetch_) {
544 ++stats.numPrefetch;
545 stats.prefetchBytes += entry->size();
546 }
547 ++stats.numEntries;
548 stats.tinySize += entry->tinyData_.size();
549 stats.tinyPadding += entry->tinyData_.capacity() - entry->tinyData_.size();
550 if (entry->tinyData_.empty()) {
551 stats.largeSize += entry->size_;
552 stats.largePadding += entry->data_.byteSize() - entry->size_;
553 }
554 }
555 stats.numHit += numHit_;
556 stats.hitBytes += hitBytes_;
557 stats.numNew += numNew_;
558 stats.numEvict += numEvict_;
559 stats.numEvictChecks += numEvictChecks_;
560 stats.numWaitExclusive += numWaitExclusive_;
561 stats.numAgedOut += numAgedOut_;
562 stats.sumEvictScore += sumEvictScore_;
563 stats.allocClocks += allocClocks_;
564}
565
566void CacheShard::appendSsdSaveable(std::vector<CachePin>& pins) {
567 std::lock_guard<std::mutex> l(mutex_);

Callers 1

refreshStatsMethod · 0.45

Calls 8

isExclusiveMethod · 0.80
isSharedMethod · 0.80
hasValueMethod · 0.45
byteSizeMethod · 0.45
dataMethod · 0.45
capacityMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected