|
|
@ -31,20 +31,20 @@ const std::map<LevelStatType, LevelStat> InternalStats::compaction_level_stats = |
|
|
|
{LevelStatType::NUM_FILES, LevelStat{"NumFiles", "Files"}}, |
|
|
|
{LevelStatType::NUM_FILES, LevelStat{"NumFiles", "Files"}}, |
|
|
|
{LevelStatType::COMPACTED_FILES, |
|
|
|
{LevelStatType::COMPACTED_FILES, |
|
|
|
LevelStat{"CompactedFiles", "CompactedFiles"}}, |
|
|
|
LevelStat{"CompactedFiles", "CompactedFiles"}}, |
|
|
|
{LevelStatType::SIZE_MB, LevelStat{"SizeMB", "Size(MB}"}}, |
|
|
|
{LevelStatType::SIZE_BYTES, LevelStat{"SizeBytes", "Size"}}, |
|
|
|
{LevelStatType::SCORE, LevelStat{"Score", "Score"}}, |
|
|
|
{LevelStatType::SCORE, LevelStat{"Score", "Score"}}, |
|
|
|
{LevelStatType::READ_GB, LevelStat{"ReadGB", "Read(GB}"}}, |
|
|
|
{LevelStatType::READ_GB, LevelStat{"ReadGB", "Read(GB)"}}, |
|
|
|
{LevelStatType::RN_GB, LevelStat{"RnGB", "Rn(GB}"}}, |
|
|
|
{LevelStatType::RN_GB, LevelStat{"RnGB", "Rn(GB)"}}, |
|
|
|
{LevelStatType::RNP1_GB, LevelStat{"Rnp1GB", "Rnp1(GB}"}}, |
|
|
|
{LevelStatType::RNP1_GB, LevelStat{"Rnp1GB", "Rnp1(GB)"}}, |
|
|
|
{LevelStatType::WRITE_GB, LevelStat{"WriteGB", "Write(GB}"}}, |
|
|
|
{LevelStatType::WRITE_GB, LevelStat{"WriteGB", "Write(GB)"}}, |
|
|
|
{LevelStatType::W_NEW_GB, LevelStat{"WnewGB", "Wnew(GB}"}}, |
|
|
|
{LevelStatType::W_NEW_GB, LevelStat{"WnewGB", "Wnew(GB)"}}, |
|
|
|
{LevelStatType::MOVED_GB, LevelStat{"MovedGB", "Moved(GB}"}}, |
|
|
|
{LevelStatType::MOVED_GB, LevelStat{"MovedGB", "Moved(GB)"}}, |
|
|
|
{LevelStatType::WRITE_AMP, LevelStat{"WriteAmp", "W-Amp"}}, |
|
|
|
{LevelStatType::WRITE_AMP, LevelStat{"WriteAmp", "W-Amp"}}, |
|
|
|
{LevelStatType::READ_MBPS, LevelStat{"ReadMBps", "Rd(MB/s}"}}, |
|
|
|
{LevelStatType::READ_MBPS, LevelStat{"ReadMBps", "Rd(MB/s)"}}, |
|
|
|
{LevelStatType::WRITE_MBPS, LevelStat{"WriteMBps", "Wr(MB/s}"}}, |
|
|
|
{LevelStatType::WRITE_MBPS, LevelStat{"WriteMBps", "Wr(MB/s)"}}, |
|
|
|
{LevelStatType::COMP_SEC, LevelStat{"CompSec", "Comp(sec}"}}, |
|
|
|
{LevelStatType::COMP_SEC, LevelStat{"CompSec", "Comp(sec)"}}, |
|
|
|
{LevelStatType::COMP_COUNT, LevelStat{"CompCount", "Comp(cnt}"}}, |
|
|
|
{LevelStatType::COMP_COUNT, LevelStat{"CompCount", "Comp(cnt)"}}, |
|
|
|
{LevelStatType::AVG_SEC, LevelStat{"AvgSec", "Avg(sec}"}}, |
|
|
|
{LevelStatType::AVG_SEC, LevelStat{"AvgSec", "Avg(sec)"}}, |
|
|
|
{LevelStatType::KEY_IN, LevelStat{"KeyIn", "KeyIn"}}, |
|
|
|
{LevelStatType::KEY_IN, LevelStat{"KeyIn", "KeyIn"}}, |
|
|
|
{LevelStatType::KEY_DROP, LevelStat{"KeyDrop", "KeyDrop"}}, |
|
|
|
{LevelStatType::KEY_DROP, LevelStat{"KeyDrop", "KeyDrop"}}, |
|
|
|
}; |
|
|
|
}; |
|
|
@ -64,7 +64,7 @@ void PrintLevelStatsHeader(char* buf, size_t len, const std::string& cf_name) { |
|
|
|
buf + written_size, len - written_size, |
|
|
|
buf + written_size, len - written_size, |
|
|
|
"Level %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n", |
|
|
|
"Level %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n", |
|
|
|
// Note that we skip COMPACTED_FILES and merge it with Files column
|
|
|
|
// Note that we skip COMPACTED_FILES and merge it with Files column
|
|
|
|
hdr(LevelStatType::NUM_FILES), hdr(LevelStatType::SIZE_MB), |
|
|
|
hdr(LevelStatType::NUM_FILES), hdr(LevelStatType::SIZE_BYTES), |
|
|
|
hdr(LevelStatType::SCORE), hdr(LevelStatType::READ_GB), |
|
|
|
hdr(LevelStatType::SCORE), hdr(LevelStatType::READ_GB), |
|
|
|
hdr(LevelStatType::RN_GB), hdr(LevelStatType::RNP1_GB), |
|
|
|
hdr(LevelStatType::RN_GB), hdr(LevelStatType::RNP1_GB), |
|
|
|
hdr(LevelStatType::WRITE_GB), hdr(LevelStatType::W_NEW_GB), |
|
|
|
hdr(LevelStatType::WRITE_GB), hdr(LevelStatType::W_NEW_GB), |
|
|
@ -91,7 +91,7 @@ void PrepareLevelStats(std::map<LevelStatType, double>* level_stats, |
|
|
|
|
|
|
|
|
|
|
|
(*level_stats)[LevelStatType::NUM_FILES] = num_files; |
|
|
|
(*level_stats)[LevelStatType::NUM_FILES] = num_files; |
|
|
|
(*level_stats)[LevelStatType::COMPACTED_FILES] = being_compacted; |
|
|
|
(*level_stats)[LevelStatType::COMPACTED_FILES] = being_compacted; |
|
|
|
(*level_stats)[LevelStatType::SIZE_MB] = total_file_size / kMB; |
|
|
|
(*level_stats)[LevelStatType::SIZE_BYTES] = total_file_size; |
|
|
|
(*level_stats)[LevelStatType::SCORE] = score; |
|
|
|
(*level_stats)[LevelStatType::SCORE] = score; |
|
|
|
(*level_stats)[LevelStatType::READ_GB] = bytes_read / kGB; |
|
|
|
(*level_stats)[LevelStatType::READ_GB] = bytes_read / kGB; |
|
|
|
(*level_stats)[LevelStatType::RN_GB] = |
|
|
|
(*level_stats)[LevelStatType::RN_GB] = |
|
|
@ -117,7 +117,10 @@ void PrepareLevelStats(std::map<LevelStatType, double>* level_stats, |
|
|
|
void PrintLevelStats(char* buf, size_t len, const std::string& name, |
|
|
|
void PrintLevelStats(char* buf, size_t len, const std::string& name, |
|
|
|
const std::map<LevelStatType, double>& stat_value) { |
|
|
|
const std::map<LevelStatType, double>& stat_value) { |
|
|
|
snprintf(buf, len, |
|
|
|
snprintf(buf, len, |
|
|
|
"%4s %6d/%-3d %8.2f %5.1f " /* Level, Files, Size(MB), Score */ |
|
|
|
"%4s " /* Level */ |
|
|
|
|
|
|
|
"%6d/%-3d " /* Files */ |
|
|
|
|
|
|
|
"%8s " /* Size */ |
|
|
|
|
|
|
|
"%5.1f " /* Score */ |
|
|
|
"%8.1f " /* Read(GB) */ |
|
|
|
"%8.1f " /* Read(GB) */ |
|
|
|
"%7.1f " /* Rn(GB) */ |
|
|
|
"%7.1f " /* Rn(GB) */ |
|
|
|
"%8.1f " /* Rnp1(GB) */ |
|
|
|
"%8.1f " /* Rnp1(GB) */ |
|
|
@ -135,7 +138,9 @@ void PrintLevelStats(char* buf, size_t len, const std::string& name, |
|
|
|
name.c_str(), |
|
|
|
name.c_str(), |
|
|
|
static_cast<int>(stat_value.at(LevelStatType::NUM_FILES)), |
|
|
|
static_cast<int>(stat_value.at(LevelStatType::NUM_FILES)), |
|
|
|
static_cast<int>(stat_value.at(LevelStatType::COMPACTED_FILES)), |
|
|
|
static_cast<int>(stat_value.at(LevelStatType::COMPACTED_FILES)), |
|
|
|
stat_value.at(LevelStatType::SIZE_MB), |
|
|
|
BytesToHumanString( |
|
|
|
|
|
|
|
static_cast<uint64_t>(stat_value.at(LevelStatType::SIZE_BYTES))) |
|
|
|
|
|
|
|
.c_str(), |
|
|
|
stat_value.at(LevelStatType::SCORE), |
|
|
|
stat_value.at(LevelStatType::SCORE), |
|
|
|
stat_value.at(LevelStatType::READ_GB), |
|
|
|
stat_value.at(LevelStatType::READ_GB), |
|
|
|
stat_value.at(LevelStatType::RN_GB), |
|
|
|
stat_value.at(LevelStatType::RN_GB), |
|
|
@ -978,6 +983,7 @@ void InternalStats::DumpCFStats(std::string* value) { |
|
|
|
value->append(buf); |
|
|
|
value->append(buf); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Print sum of level stats
|
|
|
|
// Print sum of level stats
|
|
|
|
PrintLevelStats(buf, sizeof(buf), "Sum", levels_stats[-1]); |
|
|
|
PrintLevelStats(buf, sizeof(buf), "Sum", levels_stats[-1]); |
|
|
|
value->append(buf); |
|
|
|
value->append(buf); |
|
|
|