Commit c7d2448d authored by zhangjinpeng1987's avatar zhangjinpeng1987

enable statistics

parent 8896042b
......@@ -17,7 +17,7 @@ extern crate libc;
#[cfg(test)]
extern crate tempdir;
use libc::{c_char, c_uchar, c_int, c_void, size_t, uint64_t};
use libc::{c_char, c_uchar, c_int, c_uint, c_void, size_t, uint64_t};
use std::ffi::CStr;
pub enum DBOptions {}
......@@ -181,6 +181,8 @@ extern "C" {
v: c_int);
pub fn rocksdb_options_set_report_bg_io_stats(options: *mut DBOptions, v: c_int);
pub fn rocksdb_options_set_wal_recovery_mode(options: *mut DBOptions, mode: DBRecoveryMode);
pub fn rocksdb_options_enable_statistics(options: *mut DBOptions);
pub fn rocksdb_options_set_stats_dump_period_sec(options: *mut DBOptions, v: c_uint);
pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int)
-> *mut DBFilterPolicy;
pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int)
......
......@@ -181,6 +181,8 @@ mod tests {
opts.set_filter_deletes(false);
opts.set_report_bg_io_stats(true);
opts.set_wal_recovery_mode(DBRecoveryMode::PointInTime);
opts.enable_statistics();
opts.set_stats_dump_period_sec(60);
opts.compression_per_level(&per_level_compression);
blockopts.set_block_size(524288);
blockopts.set_cache_index_and_filter_blocks(true);
......
......@@ -14,7 +14,7 @@
//
use comparator::{self, ComparatorCallback, compare_callback};
use libc::{c_int, size_t};
use libc::{c_int, c_uint, size_t};
use merge_operator::{self, MergeOperatorCallback, full_merge_callback,
partial_merge_callback};
use merge_operator::MergeFn;
......@@ -505,6 +505,19 @@ impl Options {
mode);
}
}
pub fn enable_statistics(&mut self) {
unsafe {
rocksdb_ffi::rocksdb_options_enable_statistics(self.inner);
}
}
pub fn set_stats_dump_period_sec(&mut self, period: c_uint) {
unsafe {
rocksdb_ffi::rocksdb_options_set_stats_dump_period_sec(self.inner,
period);
}
}
}
#[cfg(test)]
......
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