// We're optimistic, updating the stats before we successfully
// commit. That lets us release our leader status early.
auto stats = default_cf_internal_stats_;
- stats->AddDBStats(InternalStats::NUMBER_KEYS_WRITTEN, total_count,
+ stats->AddDBStats(InternalStats::kIntStatsNumKeysWritten, total_count,
concurrent_update);
RecordTick(stats_, NUMBER_KEYS_WRITTEN, total_count);
- stats->AddDBStats(InternalStats::BYTES_WRITTEN, total_byte_size,
+ stats->AddDBStats(InternalStats::kIntStatsBytesWritten, total_byte_size,
concurrent_update);
RecordTick(stats_, BYTES_WRITTEN, total_byte_size);
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_SELF, 1, concurrent_update);
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneBySelf, 1,
+ concurrent_update);
RecordTick(stats_, WRITE_DONE_BY_SELF);
auto write_done_by_other = write_group.size - 1;
if (write_done_by_other > 0) {
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_OTHER, write_done_by_other,
- concurrent_update);
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneByOther,
+ write_done_by_other, concurrent_update);
RecordTick(stats_, WRITE_DONE_BY_OTHER, write_done_by_other);
}
MeasureTime(stats_, BYTES_PER_WRITE, total_byte_size);
}
auto stats = default_cf_internal_stats_;
- stats->AddDBStats(InternalStats::NUMBER_KEYS_WRITTEN, total_count);
+ stats->AddDBStats(InternalStats::kIntStatsNumKeysWritten, total_count);
RecordTick(stats_, NUMBER_KEYS_WRITTEN, total_count);
- stats->AddDBStats(InternalStats::BYTES_WRITTEN, total_byte_size);
+ stats->AddDBStats(InternalStats::kIntStatsBytesWritten, total_byte_size);
RecordTick(stats_, BYTES_WRITTEN, total_byte_size);
MeasureTime(stats_, BYTES_PER_WRITE, total_byte_size);
if (w.ShouldWriteToWAL()) {
PERF_TIMER_GUARD(write_wal_time);
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_SELF, 1);
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneBySelf, 1);
RecordTick(stats_, WRITE_DONE_BY_SELF, 1);
if (wal_write_group.size > 1) {
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_OTHER,
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneByOther,
wal_write_group.size - 1);
RecordTick(stats_, WRITE_DONE_BY_OTHER, wal_write_group.size - 1);
}
// We're optimistic, updating the stats before we successfully
// commit. That lets us release our leader status early.
auto stats = default_cf_internal_stats_;
- stats->AddDBStats(InternalStats::BYTES_WRITTEN, total_byte_size,
+ stats->AddDBStats(InternalStats::kIntStatsBytesWritten, total_byte_size,
concurrent_update);
RecordTick(stats_, BYTES_WRITTEN, total_byte_size);
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_SELF, 1, concurrent_update);
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneBySelf, 1,
+ concurrent_update);
RecordTick(stats_, WRITE_DONE_BY_SELF);
auto write_done_by_other = write_group.size - 1;
if (write_done_by_other > 0) {
- stats->AddDBStats(InternalStats::WRITE_DONE_BY_OTHER, write_done_by_other,
- concurrent_update);
+ stats->AddDBStats(InternalStats::kIntStatsWriteDoneByOther,
+ write_done_by_other, concurrent_update);
RecordTick(stats_, WRITE_DONE_BY_OTHER, write_done_by_other);
}
MeasureTime(stats_, BYTES_PER_WRITE, total_byte_size);
if (status.ok()) {
auto stats = default_cf_internal_stats_;
if (need_log_sync) {
- stats->AddDBStats(InternalStats::WAL_FILE_SYNCED, 1);
+ stats->AddDBStats(InternalStats::kIntStatsWalFileSynced, 1);
RecordTick(stats_, WAL_FILE_SYNCED);
}
- stats->AddDBStats(InternalStats::WAL_FILE_BYTES, log_size);
+ stats->AddDBStats(InternalStats::kIntStatsWalFileBytes, log_size);
RecordTick(stats_, WAL_FILE_BYTES, log_size);
- stats->AddDBStats(InternalStats::WRITE_WITH_WAL, write_with_wal);
+ stats->AddDBStats(InternalStats::kIntStatsWriteWithWal, write_with_wal);
RecordTick(stats_, WRITE_WITH_WAL, write_with_wal);
}
return status;
if (status.ok()) {
const bool concurrent = true;
auto stats = default_cf_internal_stats_;
- stats->AddDBStats(InternalStats::WAL_FILE_BYTES, log_size, concurrent);
+ stats->AddDBStats(InternalStats::kIntStatsWalFileBytes, log_size,
+ concurrent);
RecordTick(stats_, WAL_FILE_BYTES, log_size);
- stats->AddDBStats(InternalStats::WRITE_WITH_WAL, write_with_wal,
+ stats->AddDBStats(InternalStats::kIntStatsWriteWithWal, write_with_wal,
concurrent);
RecordTick(stats_, WRITE_WITH_WAL, write_with_wal);
}
}
assert(!delayed || !write_options.no_slowdown);
if (delayed) {
- default_cf_internal_stats_->AddDBStats(InternalStats::WRITE_STALL_MICROS,
- time_delayed);
+ default_cf_internal_stats_->AddDBStats(
+ InternalStats::kIntStatsWriteStallMicros, time_delayed);
RecordTick(stats_, STALL_MICROS, time_delayed);
}
seconds_up, interval_seconds_up);
value->append(buf);
// Cumulative
- uint64_t user_bytes_written = GetDBStats(InternalStats::BYTES_WRITTEN);
- uint64_t num_keys_written = GetDBStats(InternalStats::NUMBER_KEYS_WRITTEN);
- uint64_t write_other = GetDBStats(InternalStats::WRITE_DONE_BY_OTHER);
- uint64_t write_self = GetDBStats(InternalStats::WRITE_DONE_BY_SELF);
- uint64_t wal_bytes = GetDBStats(InternalStats::WAL_FILE_BYTES);
- uint64_t wal_synced = GetDBStats(InternalStats::WAL_FILE_SYNCED);
- uint64_t write_with_wal = GetDBStats(InternalStats::WRITE_WITH_WAL);
- uint64_t write_stall_micros = GetDBStats(InternalStats::WRITE_STALL_MICROS);
+ uint64_t user_bytes_written =
+ GetDBStats(InternalStats::kIntStatsBytesWritten);
+ uint64_t num_keys_written =
+ GetDBStats(InternalStats::kIntStatsNumKeysWritten);
+ uint64_t write_other = GetDBStats(InternalStats::kIntStatsWriteDoneByOther);
+ uint64_t write_self = GetDBStats(InternalStats::kIntStatsWriteDoneBySelf);
+ uint64_t wal_bytes = GetDBStats(InternalStats::kIntStatsWalFileBytes);
+ uint64_t wal_synced = GetDBStats(InternalStats::kIntStatsWalFileSynced);
+ uint64_t write_with_wal = GetDBStats(InternalStats::kIntStatsWriteWithWal);
+ uint64_t write_stall_micros =
+ GetDBStats(InternalStats::kIntStatsWriteStallMicros);
const int kHumanMicrosLen = 32;
char human_micros[kHumanMicrosLen];
};
enum InternalDBStatsType {
- WAL_FILE_BYTES,
- WAL_FILE_SYNCED,
- BYTES_WRITTEN,
- NUMBER_KEYS_WRITTEN,
- WRITE_DONE_BY_OTHER,
- WRITE_DONE_BY_SELF,
- WRITE_WITH_WAL,
- WRITE_STALL_MICROS,
- INTERNAL_DB_STATS_ENUM_MAX,
+ kIntStatsWalFileBytes,
+ kIntStatsWalFileSynced,
+ kIntStatsBytesWritten,
+ kIntStatsNumKeysWritten,
+ kIntStatsWriteDoneByOther,
+ kIntStatsWriteDoneBySelf,
+ kIntStatsWriteWithWal,
+ kIntStatsWriteStallMicros,
+ kIntStatsNumMax,
};
InternalStats(int num_levels, Env* env, ColumnFamilyData* cfd)
};
void Clear() {
- for (int i = 0; i < INTERNAL_DB_STATS_ENUM_MAX; i++) {
+ for (int i = 0; i < kIntStatsNumMax; i++) {
db_stats_[i].store(0);
}
for (int i = 0; i < INTERNAL_CF_STATS_ENUM_MAX; i++) {
bool HandleBlockCacheStat(Cache** block_cache);
// Per-DB stats
- std::atomic<uint64_t> db_stats_[INTERNAL_DB_STATS_ENUM_MAX];
+ std::atomic<uint64_t> db_stats_[kIntStatsNumMax];
// Per-ColumnFamily stats
uint64_t cf_stats_value_[INTERNAL_CF_STATS_ENUM_MAX];
uint64_t cf_stats_count_[INTERNAL_CF_STATS_ENUM_MAX];
};
enum InternalDBStatsType {
- WAL_FILE_BYTES,
- WAL_FILE_SYNCED,
- BYTES_WRITTEN,
- NUMBER_KEYS_WRITTEN,
- WRITE_DONE_BY_OTHER,
- WRITE_DONE_BY_SELF,
- WRITE_WITH_WAL,
- WRITE_STALL_MICROS,
- INTERNAL_DB_STATS_ENUM_MAX,
+ kIntStatsWalFileBytes,
+ kIntStatsWalFileSynced,
+ kIntStatsBytesWritten,
+ kIntStatsNumKeysWritten,
+ kIntStatsWriteDoneByOther,
+ kIntStatsWriteDoneBySelf,
+ kIntStatsWriteWithWal,
+ kIntStatsWriteStallMicros,
+ kIntStatsNumMax,
};
InternalStats(int /*num_levels*/, Env* /*env*/, ColumnFamilyData* /*cfd*/) {}