Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #613 from ethcore/jdb_option1
Browse files Browse the repository at this point in the history
JournalDB option 1 fix
  • Loading branch information
Gav Wood committed Mar 7, 2016
2 parents 7e9f137 + 4d1effb commit 318e7e9
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 97 deletions.
8 changes: 6 additions & 2 deletions ethcore/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ pub struct ClientReport {
pub transactions_applied: usize,
/// How much gas has been processed so far.
pub gas_processed: U256,
/// Memory used by state DB
pub state_db_mem: usize,
}

impl ClientReport {
Expand Down Expand Up @@ -222,7 +224,7 @@ pub struct Client<V = CanonVerifier> where V: Verifier {
}

const HISTORY: u64 = 1000;
const CLIENT_DB_VER_STR: &'static str = "4.0";
const CLIENT_DB_VER_STR: &'static str = "5.1";

impl Client<CanonVerifier> {
/// Create a new client with given spec and DB path.
Expand Down Expand Up @@ -432,7 +434,9 @@ impl<V> Client<V> where V: Verifier {

/// Get the report.
pub fn report(&self) -> ClientReport {
self.report.read().unwrap().clone()
let mut report = self.report.read().unwrap().clone();
report.state_db_mem = self.state_db.lock().unwrap().mem_used();
report
}

/// Tick the client.
Expand Down
3 changes: 2 additions & 1 deletion parity/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ impl Informant {
let sync_info = sync.status();

if let (_, _, &Some(ref last_report)) = (self.chain_info.read().unwrap().deref(), self.cache_info.read().unwrap().deref(), self.report.read().unwrap().deref()) {
println!("[ #{} {} ]---[ {} blk/s | {} tx/s | {} gas/s //··· {}/{} peers, #{}, {}+{} queued ···// mem: {} chain, {} queue, {} sync ]",
println!("[ #{} {} ]---[ {} blk/s | {} tx/s | {} gas/s //··· {}/{} peers, #{}, {}+{} queued ···// mem: {} db, {} chain, {} queue, {} sync ]",
chain_info.best_block_number,
chain_info.best_block_hash,
(report.blocks_imported - last_report.blocks_imported) / dur,
Expand All @@ -408,6 +408,7 @@ impl Informant {
queue_info.unverified_queue_size,
queue_info.verified_queue_size,

Informant::format_bytes(report.state_db_mem),
Informant::format_bytes(cache_info.total()),
Informant::format_bytes(queue_info.mem_used),
Informant::format_bytes(sync_info.mem_used),
Expand Down
Loading

0 comments on commit 318e7e9

Please sign in to comment.