i/o stats for backend databases (#4525)

This commit is contained in:
Nikolay Volf
2020-01-07 21:53:03 +03:00
committed by GitHub
parent 9500eb7590
commit df4058b556
16 changed files with 245 additions and 55 deletions
+1 -1
View File
@@ -1176,7 +1176,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
pub fn usage_info(&self) -> ClientInfo<Block> {
ClientInfo {
chain: self.chain_info(),
used_state_cache_size: self.backend.used_state_cache_size(),
usage: self.backend.usage_info(),
}
}
+6 -1
View File
@@ -37,6 +37,7 @@ use sc_client_api::{
blockchain::{
self, BlockStatus, HeaderBackend, well_known_cache_keys::Id as CacheKeyId
},
UsageInfo,
};
use crate::leaves::LeafSet;
@@ -449,6 +450,10 @@ impl<Block: BlockT> sc_client_api::light::Storage<Block> for Blockchain<Block>
fn cache(&self) -> Option<Arc<dyn blockchain::Cache<Block>>> {
None
}
fn usage_info(&self) -> Option<sc_client_api::UsageInfo> {
None
}
}
/// In-memory operation.
@@ -681,7 +686,7 @@ where
&self.blockchain
}
fn used_state_cache_size(&self) -> Option<usize> {
fn usage_info(&self) -> Option<UsageInfo> {
None
}
+3 -2
View File
@@ -39,6 +39,7 @@ use sc_client_api::{
HeaderBackend as BlockchainHeaderBackend, well_known_cache_keys,
},
light::Storage as BlockchainStorage,
UsageInfo,
};
use crate::light::blockchain::Blockchain;
use hash_db::Hasher;
@@ -186,8 +187,8 @@ impl<S, Block, H> ClientBackend<Block, H> for Backend<S, H> where
&self.blockchain
}
fn used_state_cache_size(&self) -> Option<usize> {
None
fn usage_info(&self) -> Option<UsageInfo> {
self.blockchain.storage().usage_info()
}
fn changes_trie_storage(&self) -> Option<&Self::ChangesTrieStorage> {
+4
View File
@@ -314,5 +314,9 @@ pub mod tests {
fn cache(&self) -> Option<Arc<dyn BlockchainCache<Block>>> {
None
}
fn usage_info(&self) -> Option<sc_client_api::UsageInfo> {
None
}
}
}