@@ -25,17 +25,30 @@ 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+ // size of evicted items
40+ uint64_t evictionSize;
41+ };
42+
2843struct Stats {
44+ BackgroundEvictionStats backgndEvicStats;
45+
2946 uint64_t numEvictions{0 };
3047 uint64_t numItems{0 };
3148
3249 uint64_t allocAttempts{0 };
3350 uint64_t allocFailures{0 };
3451
35- uint64_t numBackgroundEvictions{0 };
36- uint64_t numBackgroundEvictionsFromSchedule{0 };
37- uint64_t numBackgroundEvictorRuns{0 };
38-
3952 uint64_t numCacheGets{0 };
4053 uint64_t numCacheGetMiss{0 };
4154 uint64_t numRamDestructorCalls{0 };
@@ -118,12 +131,15 @@ struct Stats {
118131 invertPctFn (allocFailures, allocAttempts))
119132 << std::endl;
120133 out << folly::sformat (" RAM Evictions : {:,}" , numEvictions) << std::endl;
121-
122134
123- out << folly::sformat (" Background Tier 0 Evictions : {:,}" , numBackgroundEvictions) << std::endl;
124- out << folly::sformat (" Background Tier 0 Evictions from schedule() : {:,}" , numBackgroundEvictionsFromSchedule) << std::endl;
125-
126- out << folly::sformat (" Background Tier 0 Eviction Runs : {:,}" , numBackgroundEvictorRuns) << std::endl;
135+ out << folly::sformat (" Tier 0 Background Evicted items : {:,}" ,
136+ backgndEvicStats.nEvictedItems ) << std::endl;
137+ out << folly::sformat (" Tier 0 Background Evicted items from schedule : {:,}" ,
138+ backgndEvicStats.nEvictedItemsFromSchedule ) << std::endl;
139+ out << folly::sformat (" Tier 0 Background Traversals : {:,}" ,
140+ backgndEvicStats.nTraversals ) << std::endl;
141+ out << folly::sformat (" Tier 0 Background Evicted Size : {:,}" ,
142+ backgndEvicStats.evictionSize ) << std::endl;
127143
128144 if (numCacheGets > 0 ) {
129145 out << folly::sformat (" Cache Gets : {:,}" , numCacheGets) << std::endl;
0 commit comments