uint64_t num_wr;
/// objects written in KB
uint64_t num_wr_kb;
+ ///< bytes originally provided by user
+ uint64_t num_user_bytes;
+ ///< bytes passed compression
+ uint64_t compressed_bytes_orig;
+ ///< bytes resulted after compression
+ uint64_t compressed_bytes;
+ ///< bytes allocated at storage
+ uint64_t compressed_bytes_alloc;
};
/**
}
::pool_stat_t& r = rawresult[pool_name];
- stats->num_kb = shift_round_up(r.stats.sum.num_bytes, 10);
- stats->num_bytes = r.stats.sum.num_bytes;
+ uint64_t allocated_bytes = r.get_allocated_bytes();
+ // again, raw_used_rate is unknown hence using num_store_stats that
+ // will produce results similar to get_allocated_bytes(1.0) for legacy mode
+ // and stored / num_store_stats for the new collection mode
+ uint64_t user_bytes = r.get_user_bytes(r.num_store_stats);
+
+ stats->num_kb = shift_round_up(allocated_bytes, 10);
+ stats->num_bytes = allocated_bytes;
stats->num_objects = r.stats.sum.num_objects;
stats->num_object_clones = r.stats.sum.num_object_clones;
stats->num_object_copies = r.stats.sum.num_object_copies;
stats->num_rd_kb = r.stats.sum.num_rd_kb;
stats->num_wr = r.stats.sum.num_wr;
stats->num_wr_kb = r.stats.sum.num_wr_kb;
+ stats->num_user_bytes = user_bytes;
+ stats->compressed_bytes_orig = r.store_stats.data_compressed_original;
+ stats->compressed_bytes = r.store_stats.data_compressed;
+ stats->compressed_bytes_alloc = r.store_stats.data_compressed_allocated;
+
tracepoint(librados, rados_ioctx_pool_stat_exit, 0, stats);
return 0;
}
p != rawresult.end();
++p) {
pool_stat_t& pv = result[p->first];
+ auto& pstat = p->second;
+ store_statfs_t &statfs = pstat.store_stats;
+ uint64_t allocated_bytes = pstat.get_allocated_bytes();
+ // again, raw_used_rate is unknown hence using num_store_stats that
+ // will produce results similar to get_allocated_bytes() for legacy mode
+ // and stored / num_store_stats for the new collection mode
+ uint64_t user_bytes = pstat.get_user_bytes(pstat.num_store_stats);
+
object_stat_sum_t *sum = &p->second.stats.sum;
- pv.num_kb = shift_round_up(sum->num_bytes, 10);
- pv.num_bytes = sum->num_bytes;
+ pv.num_kb = shift_round_up(allocated_bytes, 10);
+ pv.num_bytes = allocated_bytes;
pv.num_objects = sum->num_objects;
pv.num_object_clones = sum->num_object_clones;
pv.num_object_copies = sum->num_object_copies;
pv.num_rd_kb = sum->num_rd_kb;
pv.num_wr = sum->num_wr;
pv.num_wr_kb = sum->num_wr_kb;
+ pv.num_user_bytes = user_bytes;
+ pv.compressed_bytes_orig = statfs.data_compressed_original;
+ pv.compressed_bytes = statfs.data_compressed;
+ pv.compressed_bytes_alloc = statfs.data_compressed_allocated;
}
return r;
}
#include "messages/PaxosServiceMessage.h"
class MPGStats : public MessageInstance<MPGStats, PaxosServiceMessage> {
- static const int HEAD_VERSION = 2;
- static const int COMPAT_VERSION = 1;
+ static constexpr int HEAD_VERSION = 2;
+ static constexpr int COMPAT_VERSION = 1;
public:
friend factory;
} else {
avail = avail_by_rule[ruleno];
}
-
if (f) {
f->open_object_section("pool");
f->dump_string("name", pool_name);
raw_used_rate *= (float)(sum.num_object_copies - sum.num_objects_degraded) / sum.num_object_copies;
}
+ uint64_t used_bytes = pool_stat.get_allocated_bytes();
+
float used = 0.0;
// note avail passed in is raw_avail, calc raw_used here.
if (avail) {
- used = statfs.allocated;
+ used = used_bytes;
used /= used + avail;
- } else if (statfs.allocated) {
+ } else if (used_bytes) {
used = 1.0;
}
auto avail_res = raw_used_rate ? avail / raw_used_rate : 0;
// an approximation for actually stored user data
auto stored_normalized =
- raw_used_rate ? statfs.stored / raw_used_rate : 0;
+ raw_used_rate ? statfs.data_stored / raw_used_rate : 0;
if (f) {
- f->dump_int("kb_used", shift_round_up(statfs.allocated, 10));
- f->dump_int("bytes_used", statfs.allocated);
+ f->dump_int("kb_used", shift_round_up(used_bytes, 10));
+ f->dump_int("bytes_used", used_bytes);
f->dump_float("percent_used", used);
f->dump_unsigned("max_avail", avail_res);
f->dump_int("objects", sum.num_objects);
f->dump_int("wr", sum.num_wr);
f->dump_int("wr_bytes", sum.num_wr_kb * 1024ull);
f->dump_int("stored", stored_normalized);
- f->dump_int("compress_bytes_used", statfs.compressed_allocated);
- f->dump_int("compress_under_bytes", statfs.compressed_original);
+ f->dump_int("compress_bytes_used", statfs.data_compressed_allocated);
+ f->dump_int("compress_under_bytes", statfs.data_compressed_original);
// Stored by user amplified by replication
- f->dump_int("stored_raw", statfs.stored);
+ f->dump_int("stored_raw", statfs.data_stored);
}
} else {
tbl << stringify(byte_u_t(statfs.allocated));
<< stringify(byte_u_t(sum.num_rd))
<< stringify(byte_u_t(sum.num_wr))
<< stringify(byte_u_t(stored_normalized))
- << stringify(byte_u_t(statfs.compressed_allocated))
- << stringify(byte_u_t(statfs.compressed_original))
+ << stringify(byte_u_t(statfs.data_compressed_allocated))
+ << stringify(byte_u_t(statfs.data_compressed_original))
;
}
}
tab.define_column("RD", TextTable::RIGHT, TextTable::RIGHT);
tab.define_column("WR_OPS", TextTable::RIGHT, TextTable::RIGHT);
tab.define_column("WR", TextTable::RIGHT, TextTable::RIGHT);
+ tab.define_column("USED COMPR", TextTable::RIGHT, TextTable::RIGHT);
+ tab.define_column("UNDER COMPR", TextTable::RIGHT, TextTable::RIGHT);
} else {
formatter->open_object_section("stats");
formatter->open_array_section("pools");
<< byte_u_t(s.num_rd_kb << 10)
<< s.num_wr
<< byte_u_t(s.num_wr_kb << 10)
+ << byte_u_t(s.compressed_bytes_alloc)
+ << byte_u_t(s.compressed_bytes_orig)
<< TextTable::endrow;
} else {
formatter->open_object_section("pool");
formatter->dump_int("read_bytes", s.num_rd_kb * 1024ull);
formatter->dump_int("write_ops", s.num_wr);
formatter->dump_int("write_bytes", s.num_wr_kb * 1024ull);
+ formatter->dump_int("compress_bytes_used", s.compressed_bytes_alloc);
+ formatter->dump_int("compress_under_bytes", s.compressed_bytes_orig);
formatter->close_section();
}
}