diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index c8b6221a5..4c4b596c7 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -1353,6 +1353,9 @@ DBDumperCommand::DBDumperCommand( itr = options.find(ARG_PATH); if (itr != options.end()) { path_ = itr->second; + if (db_path_.empty()) { + db_path_ = path_; + } } } @@ -1485,6 +1488,8 @@ void DBDumperCommand::DoDumpCommand() { ReadableTime(ttl_start).c_str(), ReadableTime(ttl_end).c_str()); } + HistogramImpl vsize_hist; + for (; iter->Valid(); iter->Next()) { int rawtime = 0; // If end marker was specified, we stop before it @@ -1529,7 +1534,9 @@ void DBDumperCommand::DoDumpCommand() { } - + if (count_only_) { + vsize_hist.Add(iter->value().size()); + } if (!count_only_ && !count_delim_) { if (is_db_ttl_ && timestamp_) { @@ -1551,6 +1558,11 @@ void DBDumperCommand::DoDumpCommand() { } else { fprintf(stdout, "Keys in range: %lld\n", (long long) count); } + + if (count_only_) { + fprintf(stdout, "Value size distribution: \n"); + fprintf(stdout, "%s\n", vsize_hist.ToString().c_str()); + } // Clean up delete iter; }