}
cache_size_stats_t lru_sizes_ps = cache_total.lru_sizes;
- lru_sizes_ps.size /= seastar::smp::count;
- lru_sizes_ps.num_extents /= seastar::smp::count;
+ lru_sizes_ps.divide_by(seastar::smp::count);
cache_io_stats_t lru_io_ps = cache_total.lru_io;
- lru_io_ps.in_sizes.size /= seastar::smp::count;
- lru_io_ps.in_sizes.num_extents /= seastar::smp::count;
- lru_io_ps.out_sizes.size /= seastar::smp::count;
- lru_io_ps.out_sizes.num_extents /= seastar::smp::count;
+ lru_io_ps.divide_by(seastar::smp::count);
INFO("cache lru: total{} {}; per-shard: total{} {}",
cache_total.lru_sizes,
cache_io_stats_printer_t{seconds, cache_total.lru_io},
cache_io_stats_printer_t{seconds, lru_io_ps});
cache_size_stats_t dirty_sizes_ps = cache_total.dirty_sizes;
- dirty_sizes_ps.size /= seastar::smp::count;
- dirty_sizes_ps.num_extents /= seastar::smp::count;
+ dirty_sizes_ps.divide_by(seastar::smp::count);
dirty_io_stats_t dirty_io_ps = cache_total.dirty_io;
- dirty_io_ps.in_sizes.size /= seastar::smp::count;
- dirty_io_ps.in_sizes.num_extents /= seastar::smp::count;
- dirty_io_ps.num_replace /= seastar::smp::count;
- dirty_io_ps.out_sizes.size /= seastar::smp::count;
- dirty_io_ps.out_sizes.num_extents /= seastar::smp::count;
- dirty_io_ps.out_versions /= seastar::smp::count;
+ dirty_io_ps.divide_by(seastar::smp::count);
INFO("cache dirty: total{} {}; per-shard: total{} {}",
cache_total.dirty_sizes,
dirty_io_stats_printer_t{seconds, cache_total.dirty_io},
dirty_io_stats_printer_t{seconds, dirty_io_ps});
cache_access_stats_t access_ps = cache_total.access;
- access_ps.cache_absent /= seastar::smp::count;
- access_ps.s.trans_pending /= seastar::smp::count;
- access_ps.s.trans_dirty /= seastar::smp::count;
- access_ps.s.trans_lru /= seastar::smp::count;
- access_ps.s.cache_dirty /= seastar::smp::count;
- access_ps.s.cache_lru /= seastar::smp::count;
- access_ps.s.load_absent /= seastar::smp::count;
- access_ps.s.load_present /= seastar::smp::count;
+ access_ps.divide_by(seastar::smp::count);
INFO("cache_access: total{}; per-shard{}",
cache_access_stats_printer_t{seconds, cache_total.access},
cache_access_stats_printer_t{seconds, access_ps});
size -= o.size;
num_extents -= o.num_extents;
}
+
+ void divide_by(unsigned d) {
+ size /= d;
+ num_extents /= d;
+ }
};
std::ostream& operator<<(std::ostream&, const cache_size_stats_t&);
struct cache_size_stats_printer_t {
in_sizes.minus(o.in_sizes);
out_sizes.minus(o.out_sizes);
}
+
+ void divide_by(unsigned d) {
+ in_sizes.divide_by(d);
+ out_sizes.divide_by(d);
+ }
};
struct cache_io_stats_printer_t {
double seconds;
out_sizes.minus(o.out_sizes);
out_versions -= o.out_versions;
}
+
+ void divide_by(unsigned d) {
+ in_sizes.divide_by(d);
+ num_replace /= d;
+ out_sizes.divide_by(d);
+ out_versions /= d;
+ }
};
struct dirty_io_stats_printer_t {
double seconds;
load_absent -= o.load_absent;
load_present -= o.load_present;
}
+
+ void divide_by(unsigned d) {
+ trans_pending /= d;
+ trans_dirty /= d;
+ trans_lru /= d;
+ cache_dirty /= d;
+ cache_lru /= d;
+ load_absent /= d;
+ load_present /= d;
+ }
};
struct extent_access_stats_printer_t {
double seconds;
s.minus(o.s);
cache_absent -= o.cache_absent;
}
+
+ void divide_by(unsigned d) {
+ s.divide_by(d);
+ cache_absent /= d;
+ }
};
struct cache_access_stats_printer_t {
double seconds;