Unverified Commit 51f5d851 authored by Wallace's avatar Wallace Committed by GitHub

add write thread wait time for perf context (#439)

* add write thread wait time for perf context
parent 5c93ea57
...@@ -4969,6 +4969,14 @@ uint64_t crocksdb_perf_context_db_mutex_lock_nanos(crocksdb_perf_context_t* ctx) ...@@ -4969,6 +4969,14 @@ uint64_t crocksdb_perf_context_db_mutex_lock_nanos(crocksdb_perf_context_t* ctx)
return ctx->rep.db_mutex_lock_nanos; return ctx->rep.db_mutex_lock_nanos;
} }
uint64_t crocksdb_perf_context_write_thread_wait_nanos(crocksdb_perf_context_t* ctx) {
return ctx->rep.write_thread_wait_nanos;
}
uint64_t crocksdb_perf_context_write_scheduling_flushes_compactions_time(crocksdb_perf_context_t* ctx) {
return ctx->rep.write_scheduling_flushes_compactions_time;
}
uint64_t crocksdb_perf_context_db_condition_wait_nanos(crocksdb_perf_context_t* ctx) { uint64_t crocksdb_perf_context_db_condition_wait_nanos(crocksdb_perf_context_t* ctx) {
return ctx->rep.db_condition_wait_nanos; return ctx->rep.db_condition_wait_nanos;
} }
......
...@@ -1952,6 +1952,10 @@ crocksdb_perf_context_write_pre_and_post_process_time(crocksdb_perf_context_t*); ...@@ -1952,6 +1952,10 @@ crocksdb_perf_context_write_pre_and_post_process_time(crocksdb_perf_context_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_perf_context_db_mutex_lock_nanos(crocksdb_perf_context_t*); crocksdb_perf_context_db_mutex_lock_nanos(crocksdb_perf_context_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_perf_context_write_thread_wait_nanos(crocksdb_perf_context_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_perf_context_write_scheduling_flushes_compactions_time(crocksdb_perf_context_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_perf_context_db_condition_wait_nanos(crocksdb_perf_context_t*); crocksdb_perf_context_db_condition_wait_nanos(crocksdb_perf_context_t*);
extern C_ROCKSDB_LIBRARY_API uint64_t extern C_ROCKSDB_LIBRARY_API uint64_t
crocksdb_perf_context_merge_operator_time_nanos(crocksdb_perf_context_t*); crocksdb_perf_context_merge_operator_time_nanos(crocksdb_perf_context_t*);
......
...@@ -1947,6 +1947,10 @@ extern "C" { ...@@ -1947,6 +1947,10 @@ extern "C" {
pub fn crocksdb_perf_context_write_delay_time(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_write_delay_time(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_write_pre_and_post_process_time(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_write_pre_and_post_process_time(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_db_mutex_lock_nanos(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_db_mutex_lock_nanos(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_write_thread_wait_nanos(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_write_scheduling_flushes_compactions_time(
ctx: *mut DBPerfContext,
) -> u64;
pub fn crocksdb_perf_context_db_condition_wait_nanos(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_db_condition_wait_nanos(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_merge_operator_time_nanos(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_merge_operator_time_nanos(ctx: *mut DBPerfContext) -> u64;
pub fn crocksdb_perf_context_read_index_block_nanos(ctx: *mut DBPerfContext) -> u64; pub fn crocksdb_perf_context_read_index_block_nanos(ctx: *mut DBPerfContext) -> u64;
......
...@@ -19,6 +19,7 @@ pub enum PerfLevel { ...@@ -19,6 +19,7 @@ pub enum PerfLevel {
Disable, Disable,
EnableCount, EnableCount,
EnableTimeExceptForMutex, EnableTimeExceptForMutex,
EnableTimeAndCPUTimeExceptForMutex,
EnableTime, EnableTime,
OutOfBounds, OutOfBounds,
} }
...@@ -30,8 +31,9 @@ pub fn get_perf_level() -> PerfLevel { ...@@ -30,8 +31,9 @@ pub fn get_perf_level() -> PerfLevel {
1 => PerfLevel::Disable, 1 => PerfLevel::Disable,
2 => PerfLevel::EnableCount, 2 => PerfLevel::EnableCount,
3 => PerfLevel::EnableTimeExceptForMutex, 3 => PerfLevel::EnableTimeExceptForMutex,
4 => PerfLevel::EnableTime, 4 => PerfLevel::EnableTimeAndCPUTimeExceptForMutex,
5 => PerfLevel::OutOfBounds, 5 => PerfLevel::EnableTime,
6 => PerfLevel::OutOfBounds,
_ => unreachable!(), _ => unreachable!(),
} }
} }
...@@ -42,8 +44,9 @@ pub fn set_perf_level(level: PerfLevel) { ...@@ -42,8 +44,9 @@ pub fn set_perf_level(level: PerfLevel) {
PerfLevel::Disable => 1, PerfLevel::Disable => 1,
PerfLevel::EnableCount => 2, PerfLevel::EnableCount => 2,
PerfLevel::EnableTimeExceptForMutex => 3, PerfLevel::EnableTimeExceptForMutex => 3,
PerfLevel::EnableTime => 4, PerfLevel::EnableTimeAndCPUTimeExceptForMutex => 4,
PerfLevel::OutOfBounds => 5, PerfLevel::EnableTime => 5,
PerfLevel::OutOfBounds => 6,
}; };
unsafe { unsafe {
crocksdb_ffi::crocksdb_set_perf_level(v); crocksdb_ffi::crocksdb_set_perf_level(v);
...@@ -203,6 +206,18 @@ impl PerfContext { ...@@ -203,6 +206,18 @@ impl PerfContext {
unsafe { crocksdb_ffi::crocksdb_perf_context_db_mutex_lock_nanos(self.inner) } unsafe { crocksdb_ffi::crocksdb_perf_context_db_mutex_lock_nanos(self.inner) }
} }
pub fn write_thread_wait_nanos(&self) -> u64 {
unsafe { crocksdb_ffi::crocksdb_perf_context_write_thread_wait_nanos(self.inner) }
}
pub fn write_scheduling_flushes_compactions_time(&self) -> u64 {
unsafe {
crocksdb_ffi::crocksdb_perf_context_write_scheduling_flushes_compactions_time(
self.inner,
)
}
}
pub fn db_condition_wait_nanos(&self) -> u64 { pub fn db_condition_wait_nanos(&self) -> u64 {
unsafe { crocksdb_ffi::crocksdb_perf_context_db_condition_wait_nanos(self.inner) } unsafe { crocksdb_ffi::crocksdb_perf_context_db_condition_wait_nanos(self.inner) }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment