Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 74 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ journaldb = { path = "util/journaldb" }
jsonrpc-core = "14.0.3"
keccak-hash = "0.4.0"
kvdb = "0.4.0"
kvdb-rocksdb = "0.5.0"
kvdb-rocksdb = "0.6.0"
log = "0.4"
migration-rocksdb = { path = "util/migration-rocksdb" }
node-filter = { path = "ethcore/node-filter" }
Expand Down
4 changes: 2 additions & 2 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ethcore/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion ethcore/snapshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion ethcore/snapshot/snapshot-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
16 changes: 14 additions & 2 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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
}

Expand Down
21 changes: 21 additions & 0 deletions ethcore/types/src/client_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Comment thread
niklasad1 marked this conversation as resolved.
/// 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 {
Expand Down
2 changes: 1 addition & 1 deletion ethcore/verification/src/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an unrelated change, sorry

};

let state = Arc::new((Mutex::new(State::Work(default_amount)), Condvar::new()));
Expand Down
8 changes: 8 additions & 0 deletions parity/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ impl<T: InformantData> Informant<T> {
(diffed, full_report)
};

debug!(
target: "io_stats",
"{} reads, {} writes, {} transactions",
client_report.io_stats.reads,
client_report.io_stats.writes,
client_report.io_stats.transactions,
);

let Report {
importing,
chain_info,
Expand Down
4 changes: 4 additions & 0 deletions util/journaldb/src/archivedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ impl JournalDB for ArchiveDB {
Box::new(self.clone())
}

fn io_stats(&self) -> kvdb::IoStats {
self.backing.io_stats(kvdb::IoStatsKind::SincePrevious)
}

fn mem_used(&self) -> usize {
self.overlay.malloc_size_of()
}
Expand Down
4 changes: 4 additions & 0 deletions util/journaldb/src/earlymergedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ impl JournalDB for EarlyMergeDB {
Box::new(self.clone())
}

fn io_stats(&self) -> kvdb::IoStats {
self.backing.io_stats(kvdb::IoStatsKind::SincePrevious)
}

fn is_empty(&self) -> bool {
self.backing.get(self.column, &LATEST_ERA_KEY).expect("Low level database error").is_none()
}
Expand Down
Loading