Add status query for total bytes used by a LevelDB instance #74

Merged
merged 2 commits into from May 29, 2013
Jump to file or symbol
Failed to load files and symbols.
+9 −0
Split
View
@@ -1677,6 +1677,15 @@ bool DBImpl::GetProperty(const Slice& property, std::string* value) {
} else if (in == "sstables") {
*value = versions_->current()->DebugString();
return true;
+ } else if (in == "total-bytes") {
+ char buf[50];
+ uint64_t total = 0;
+ for (int level = 0; level < config::kNumLevels; level++) {
+ total += versions_->NumLevelBytes(level);
+ }
+ snprintf(buf, sizeof(buf), "%" PRIu64, total);
+ value->append(buf);
+ return true;
} else if (-1!=gPerfCounters->LookupCounter(in.ToString().c_str())) {
char buf[66];