@@ -25,18 +25,33 @@ DECLARE_bool(report_api_latency);
2525namespace facebook {
2626namespace cachelib {
2727namespace cachebench {
28+
29+ struct BackgroundEvictionStats {
30+ // the number of items this worker evicted by looking at pools/classes stats
31+ uint64_t nEvictedItems{0 };
32+
33+ // the number of items this worker evicted for pools/classes requested by schedule call
34+ uint64_t nEvictedItemsFromSchedule{0 };
35+
36+ // number of times we went executed the thread //TODO: is this def correct?
37+ uint64_t nTraversals{0 };
38+
39+ // number of classes
40+ uint64_t nClasses{0 };
41+
42+ // size of evicted items
43+ uint64_t evictionSize{0 };
44+ };
45+
2846struct Stats {
47+ BackgroundEvictionStats backgndEvicStats;
48+
2949 uint64_t numEvictions{0 };
3050 uint64_t numItems{0 };
3151
3252 uint64_t allocAttempts{0 };
3353 uint64_t allocFailures{0 };
3454
35- uint64_t numBackgroundEvictions{0 };
36- uint64_t numBackgroundEvictionsFromSchedule{0 };
37- uint64_t numBackgroundEvictorRuns{0 };
38- uint64_t numBackgroundEvictorClasses{0 };
39-
4055 uint64_t numCacheGets{0 };
4156 uint64_t numCacheGetMiss{0 };
4257 uint64_t numRamDestructorCalls{0 };
@@ -121,14 +136,17 @@ struct Stats {
121136 invertPctFn (allocFailures, allocAttempts))
122137 << std::endl;
123138 out << folly::sformat (" RAM Evictions : {:,}" , numEvictions) << std::endl;
124-
125139
126- out << folly::sformat (" Background Tier 0 Evictions : {:,}" , numBackgroundEvictions) << std::endl;
127- out << folly::sformat (" Background Tier 0 Evictions from schedule() : {:,}" , numBackgroundEvictionsFromSchedule) << std::endl;
128-
129- out << folly::sformat (" Background Tier 0 Eviction Runs : {:,}" , numBackgroundEvictorRuns) << std::endl;
130-
131- out << folly::sformat (" Background Tier 0 Total Classes Searched : {:,}" , numBackgroundEvictorClasses) << std::endl;
140+ out << folly::sformat (" Tier 0 Background Evicted items : {:,}" ,
141+ backgndEvicStats.nEvictedItems ) << std::endl;
142+ out << folly::sformat (" Tier 0 Background Evicted items from schedule : {:,}" ,
143+ backgndEvicStats.nEvictedItemsFromSchedule ) << std::endl;
144+ out << folly::sformat (" Tier 0 Background Traversals : {:,}" ,
145+ backgndEvicStats.nTraversals ) << std::endl;
146+ out << folly::sformat (" Tier 0 Total Classes : {:,}" ,
147+ backgndEvicStats.nClasses ) << std::endl;
148+ out << folly::sformat (" Tier 0 Background Evicted Size : {:,}" ,
149+ backgndEvicStats.evictionSize ) << std::endl;
132150
133151 if (numCacheGets >= 0 ) {
134152 out << folly::sformat (" Cache Gets : {:,}" , numCacheGets) << std::endl;
0 commit comments