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

Method updateStats

bolt/common/caching/SsdFile.cpp:488–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486void SsdFile::updateStats(SsdCacheStats& stats) const {
487 // Lock only in tsan build. Incrementing the counters has no synchronized
488 // semantics.
489 std::shared_lock<std::shared_mutex> l(mutex_);
490 stats.entriesWritten += stats_.entriesWritten;
491 stats.bytesWritten += stats_.bytesWritten;
492 stats.entriesRead += stats_.entriesRead;
493 stats.bytesRead += stats_.bytesRead;
494 stats.entriesCached += entries_.size();
495 stats.regionsCached += numRegions_;
496 for (auto i = 0; i < numRegions_; i++) {
497 stats.bytesCached += (regionSizes_[i] - erasedRegionSizes_[i]);
498 }
499 stats.entriesAgedOut += stats_.entriesAgedOut;
500 stats.regionsAgedOut += stats_.regionsAgedOut;
501 for (auto pins : regionPins_) {
502 stats.numPins += pins;
503 }
504
505 stats.openFileErrors += stats_.openFileErrors;
506 stats.openCheckpointErrors += stats_.openCheckpointErrors;
507 stats.openLogErrors += stats_.openLogErrors;
508 stats.deleteCheckpointErrors += stats_.deleteCheckpointErrors;
509 stats.growFileErrors += stats_.growFileErrors;
510 stats.writeSsdErrors += stats_.writeSsdErrors;
511 stats.writeCheckpointErrors += stats_.writeCheckpointErrors;
512 stats.readSsdErrors += stats_.readSsdErrors;
513 stats.readCheckpointErrors += stats_.readCheckpointErrors;
514}
515
516void SsdFile::clear() {
517 std::lock_guard<std::shared_mutex> l(mutex_);
518 entries_.clear();
519 std::fill(regionSizes_.begin(), regionSizes_.end(), 0);

Callers 1

statsMethod · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected