diff --git a/db/c.cc b/db/c.cc index 71c5f542c..b44da0bbb 100644 --- a/db/c.cc +++ b/db/c.cc @@ -1930,6 +1930,14 @@ void rocksdb_options_set_fifo_compaction_options( opt->rep.compaction_options_fifo = fifo->rep; } +char *rocksdb_options_statistics_get_string(rocksdb_options_t *opt) { + rocksdb::Statistics *statistics = opt->rep.statistics.get(); + if (statistics) { + return strdup(statistics->ToString().c_str()); + } + return nullptr; +} + /* TODO: DB::OpenForReadOnly diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 06cf65bd1..7dbaacd73 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -602,6 +602,9 @@ extern void rocksdb_options_set_max_bytes_for_level_multiplier_additional( rocksdb_options_t*, int* level_values, size_t num_levels); extern void rocksdb_options_enable_statistics(rocksdb_options_t*); +/* returns a pointer to a malloc()-ed, null terminated string */ +extern char *rocksdb_options_statistics_get_string(rocksdb_options_t *opt); + extern void rocksdb_options_set_max_write_buffer_number(rocksdb_options_t*, int); extern void rocksdb_options_set_min_write_buffer_number_to_merge(rocksdb_options_t*, int); extern void rocksdb_options_set_max_write_buffer_number_to_maintain(