informant: display I/O stats (#11523)

* informant: collect I/O stats for state_db

* informat: debug i/o log

* informat: remove unused cache hit ratio

* Cargo.lock: cargo update -p librocksdb-sys

* [deps]: upgrade kvdb-rocksdb to 0.6

* Update ethcore/types/src/client_types.rs

Co-Authored-By: David <dvdplm@gmail.com>

Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
Andronik Ordian
2020-03-17 16:44:27 +01:00
committed by GitHub
parent 3231454bb1
commit 70c4ed7fa0
16 changed files with 144 additions and 36 deletions

View File

@@ -33,7 +33,7 @@ journaldb = { path = "../util/journaldb" }
keccak-hash = "0.4.0"
kvdb = "0.4.0"
kvdb-memorydb = { version = "0.4.0", optional = true }
kvdb-rocksdb = { version = "0.5.0", optional = true }
kvdb-rocksdb = { version = "0.6.0", optional = true }
lazy_static = { version = "1.3", optional = true }
log = "0.4"
machine = { path = "./machine" }
@@ -78,7 +78,7 @@ ethjson = { path = "../json", features = ["test-helpers"] }
parity-crypto = { version = "0.5.0", features = ["publickey"] }
fetch = { path = "../util/fetch" }
kvdb-memorydb = "0.4.0"
kvdb-rocksdb = "0.5.0"
kvdb-rocksdb = "0.6.0"
lazy_static = "1.3"
machine = { path = "./machine", features = ["test-helpers"] }
parity-runtime = "0.1.1"

View File

@@ -23,5 +23,5 @@ trace-time = "0.1"
[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
ethcore-db = { path = "../db" }
kvdb-rocksdb = "0.5.0"
kvdb-rocksdb = "0.6.0"
tempdir = "0.3"

View File

@@ -53,7 +53,7 @@ ethabi-contract = "9.0.0"
ethabi-derive = "9.0.1"
ethcore = { path = "..", features = ["test-helpers"] }
ethkey = { path = "../../accounts/ethkey" }
kvdb-rocksdb = "0.5.0"
kvdb-rocksdb = "0.6.0"
lazy_static = { version = "1.3" }
spec = { path = "../spec" }
tempdir = "0.3"

View File

@@ -24,7 +24,7 @@ journaldb = { path = "../../../util/journaldb" }
keccak-hash = "0.4.0"
keccak-hasher = { path = "../../../util/keccak-hasher" }
kvdb = "0.4.0"
kvdb-rocksdb = "0.5.0"
kvdb-rocksdb = "0.6.0"
log = "0.4.8"
parking_lot = "0.10.0"
parity-crypto = { version = "0.5.0", features = ["publickey"] }

View File

@@ -109,7 +109,7 @@ use types::{
BlockNumber,
call_analytics::CallAnalytics,
chain_notify::{ChainMessageType, ChainRoute, NewBlocks},
client_types::{ClientReport, Mode, StateResult},
client_types::{ClientReport, IoStats, Mode, StateResult},
encoded,
engines::{
epoch::{PendingTransition, Transition as EpochTransition},
@@ -1096,7 +1096,19 @@ impl Client {
/// Get the report.
pub fn report(&self) -> ClientReport {
let mut report = self.report.read().clone();
report.state_db_mem = self.state_db.read().mem_used();
let state_db = self.state_db.read();
report.state_db_mem = state_db.mem_used();
let io_stats = state_db.journal_db().io_stats();
report.io_stats = IoStats {
transactions: io_stats.transactions,
reads: io_stats.reads,
cache_reads: io_stats.cache_reads,
writes: io_stats.writes,
bytes_read: io_stats.bytes_read,
cache_read_bytes: io_stats.cache_read_bytes,
bytes_written: io_stats.bytes_written,
};
report
}

View File

@@ -62,6 +62,27 @@ pub struct ClientReport {
pub gas_processed: U256,
/// Memory used by state DB
pub state_db_mem: usize,
/// I/O statistics for the state DB.
pub io_stats: IoStats,
}
/// I/O statistics.
#[derive(Default, Debug, Clone, Eq, PartialEq)]
pub struct IoStats {
/// Number of transaction.
pub transactions: u64,
/// Number of read operations.
pub reads: u64,
/// Number of reads resulted in a read from cache.
pub cache_reads: u64,
/// Number of write operations.
pub writes: u64,
/// Number of bytes read.
pub bytes_read: u64,
/// Number of bytes read from cache.
pub cache_read_bytes: u64,
/// Number of bytes write.
pub bytes_written: u64,
}
impl ClientReport {

View File

@@ -234,7 +234,7 @@ impl<K: Kind, C> VerificationQueue<K, C> {
let number_of_threads = if scale_verifiers {
max_verifiers
} else {
cmp::min(default_amount, max_verifiers)
default_amount
};
let state = Arc::new((Mutex::new(State::Work(default_amount)), Condvar::new()));