mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Save rocksdb statistics to file every minute (#932)
* Save rocksdb statistics to file every minute * Add flag to disable collecting rocksdb statistics
This commit is contained in:
parent
bf9848c60f
commit
7a6bfa7e7a
12 changed files with 85 additions and 11 deletions
|
@ -59,9 +59,8 @@ RocksDb RocksDb::clone() const {
|
|||
return RocksDb{db_, statistics_};
|
||||
}
|
||||
|
||||
Result<RocksDb> RocksDb::open(std::string path) {
|
||||
Result<RocksDb> RocksDb::open(std::string path, std::shared_ptr<rocksdb::Statistics> statistics) {
|
||||
rocksdb::OptimisticTransactionDB *db;
|
||||
auto statistics = rocksdb::CreateDBStatistics();
|
||||
{
|
||||
rocksdb::Options options;
|
||||
|
||||
|
@ -94,6 +93,18 @@ Result<RocksDb> RocksDb::open(std::string path) {
|
|||
return RocksDb(std::shared_ptr<rocksdb::OptimisticTransactionDB>(db), std::move(statistics));
|
||||
}
|
||||
|
||||
std::shared_ptr<rocksdb::Statistics> RocksDb::create_statistics() {
|
||||
return rocksdb::CreateDBStatistics();
|
||||
}
|
||||
|
||||
std::string RocksDb::statistics_to_string(const std::shared_ptr<rocksdb::Statistics> statistics) {
|
||||
return statistics->ToString();
|
||||
}
|
||||
|
||||
void RocksDb::reset_statistics(const std::shared_ptr<rocksdb::Statistics> statistics) {
|
||||
statistics->Reset();
|
||||
}
|
||||
|
||||
std::unique_ptr<KeyValueReader> RocksDb::snapshot() {
|
||||
auto res = std::make_unique<RocksDb>(clone());
|
||||
res->begin_snapshot().ensure();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue