1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-11-04 16:38:52 +01:00

Add rocksdb implementation of memory_usage()

This commit is contained in:
Andrej Kacian 2022-01-09 20:08:15 +01:00 committed by Timo Kösters
parent ff243870f8
commit 68ee1a5408
No known key found for this signature in database
GPG key ID: 356E705610F626D5

View file

@ -82,6 +82,19 @@ impl DatabaseEngine for Arc<Engine> {
// TODO?
Ok(())
}
fn memory_usage(&self) -> Result<String> {
let stats = rocksdb::perf::get_memory_usage_stats(Some(&[&self.rocks]), None)?;
Ok(format!("Approximate memory usage of all the mem-tables: {:.3} MB\n\
Approximate memory usage of un-flushed mem-tables: {:.3} MB\n\
Approximate memory usage of all the table readers: {:.3} MB\n\
Approximate memory usage by cache: {:.3} MB",
stats.mem_table_total as f64 / 1024.0 / 1024.0,
stats.mem_table_unflushed as f64 / 1024.0 / 1024.0,
stats.mem_table_readers_total as f64 / 1024.0 / 1024.0,
stats.cache_total as f64 / 1024.0 / 1024.0
))
}
}
impl RocksDbEngineTree<'_> {