enable statistics

master
zhangjinpeng1987 8 years ago committed by Karl Hobley
parent f542987ba7
commit fa038809e1
  1. 2
      src/ffi.rs
  2. 20
      src/rocksdb_options.rs

@ -206,6 +206,8 @@ extern "C" {
v: c_int); v: c_int);
pub fn rocksdb_options_set_report_bg_io_stats(options: DBOptions, v: c_int); pub fn rocksdb_options_set_report_bg_io_stats(options: DBOptions, v: c_int);
pub fn rocksdb_options_set_wal_recovery_mode(options: DBOptions, mode: DBRecoveryMode); pub fn rocksdb_options_set_wal_recovery_mode(options: DBOptions, mode: DBRecoveryMode);
pub fn rocksdb_options_enable_statistics(options: DBOptions);
pub fn rocksdb_options_set_stats_dump_period_sec(options: DBOptions, v: usize);
pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int) pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int)
-> DBFilterPolicy; -> DBFilterPolicy;
pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int) pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int)

@ -372,6 +372,19 @@ impl Options {
rocksdb_ffi::rocksdb_options_set_wal_recovery_mode(self.inner, mode); rocksdb_ffi::rocksdb_options_set_wal_recovery_mode(self.inner, 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: usize) {
unsafe {
rocksdb_ffi::rocksdb_options_set_stats_dump_period_sec(self.inner,
period);
}
}
} }
impl Default for Options { impl Default for Options {
@ -429,4 +442,11 @@ mod tests {
let size = 20 * 1024 * 1024; let size = 20 * 1024 * 1024;
opts.set_max_manifest_file_size(size) opts.set_max_manifest_file_size(size)
} }
#[test]
fn test_enable_statistics() {
let mut opts = Options::default();
opts.enable_statistics();
opts.set_stats_dump_period_sec(60);
}
} }

Loading…
Cancel
Save