Support cpu_write_nanos and cpu_read_nanos in IOStatsContext (#8149)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/8149

Reviewed By: ajkr

Differential Revision: D27571017

Pulled By: riversand963

fbshipit-source-id: a73427e907a7cb899debf55d60a2ede726695277
This commit is contained in:
darionyaphet 2021-04-06 00:30:57 -07:00 committed by Facebook GitHub Bot
parent 88c8f7a090
commit b2c48a570f

View File

@ -33,6 +33,8 @@ void IOStatsContext::Reset() {
prepare_write_nanos = 0;
fsync_nanos = 0;
logger_nanos = 0;
cpu_write_nanos = 0;
cpu_read_nanos = 0;
}
#define IOSTATS_CONTEXT_OUTPUT(counter) \
@ -53,6 +55,8 @@ std::string IOStatsContext::ToString(bool exclude_zero_counters) const {
IOSTATS_CONTEXT_OUTPUT(fsync_nanos);
IOSTATS_CONTEXT_OUTPUT(prepare_write_nanos);
IOSTATS_CONTEXT_OUTPUT(logger_nanos);
IOSTATS_CONTEXT_OUTPUT(cpu_write_nanos);
IOSTATS_CONTEXT_OUTPUT(cpu_read_nanos);
std::string str = ss.str();
str.erase(str.find_last_not_of(", ") + 1);