diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index e5af64208..4286dc414 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -1187,8 +1187,8 @@ impl BlockChain { let mut pending_block_details = self.pending_block_details.write(); let mut pending_write_txs = self.pending_transaction_addresses.write(); - let mut best_ancient_block = self.best_ancient_block.write(); let mut best_block = self.best_block.write(); + let mut best_ancient_block = self.best_ancient_block.write(); let mut write_block_details = self.block_details.write(); let mut write_hashes = self.block_hashes.write(); let mut write_txs = self.transaction_addresses.write(); diff --git a/parity/informant.rs b/parity/informant.rs index 905978617..4b4a5acdd 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -256,16 +256,13 @@ impl Informant { } pub fn tick(&self) { - let elapsed = self.last_tick.read().elapsed(); - if elapsed < Duration::from_secs(5) { - return; - } + let now = Instant::now(); + let elapsed = now.duration_since(*self.last_tick.read()); let (client_report, full_report) = { let mut last_report = self.last_report.lock(); let full_report = self.target.report(); let diffed = full_report.client_report.clone() - &*last_report; - *last_report = full_report.client_report.clone(); (diffed, full_report) }; @@ -289,7 +286,8 @@ impl Informant { return; } - *self.last_tick.write() = Instant::now(); + *self.last_tick.write() = now; + *self.last_report.lock() = full_report.client_report.clone(); let paint = |c: Style, t: String| match self.with_color && atty::is(atty::Stream::Stdout) { true => format!("{}", c.paint(t)), @@ -306,7 +304,7 @@ impl Informant { format!("{} blk/s {} tx/s {} Mgas/s", paint(Yellow.bold(), format!("{:7.2}", (client_report.blocks_imported * 1000) as f64 / elapsed.as_milliseconds() as f64)), paint(Yellow.bold(), format!("{:6.1}", (client_report.transactions_applied * 1000) as f64 / elapsed.as_milliseconds() as f64)), - paint(Yellow.bold(), format!("{:4}", (client_report.gas_processed / (elapsed.as_milliseconds() * 1000)).low_u64())) + paint(Yellow.bold(), format!("{:6.1}", (client_report.gas_processed / 1000).low_u64() as f64 / elapsed.as_milliseconds() as f64)) ) } else { format!("{} hdr/s",