| 526 | } |
| 527 | |
| 528 | void 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 | |
| 566 | void CacheShard::appendSsdSaveable(std::vector<CachePin>& pins) { |
| 567 | std::lock_guard<std::mutex> l(mutex_); |
no test coverage detected