Add perf counters for record/write stages (#1240)

This commit is contained in:
sakridge 2018-09-17 11:07:04 -07:00 committed by GitHub
parent 7ac9d6c604
commit 072b244575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -5,10 +5,13 @@
//! Transaction, the latest hash, and the number of hashes since the last transaction. //! Transaction, the latest hash, and the number of hashes since the last transaction.
//! The resulting stream of entries represents ordered transactions in time. //! The resulting stream of entries represents ordered transactions in time.
use counter::Counter;
use entry::Entry; use entry::Entry;
use hash::Hash; use hash::Hash;
use log::Level;
use recorder::Recorder; use recorder::Recorder;
use service::Service; use service::Service;
use std::sync::atomic::AtomicUsize;
use std::sync::mpsc::{channel, Receiver, RecvError, Sender, TryRecvError}; use std::sync::mpsc::{channel, Receiver, RecvError, Sender, TryRecvError};
use std::thread::{self, Builder, JoinHandle}; use std::thread::{self, Builder, JoinHandle};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
@ -86,8 +89,14 @@ impl RecordStage {
} else { } else {
vec![] vec![]
}; };
let txs_len = txs.len();
let entries = recorder.record(txs); let entries = recorder.record(txs);
let entries_len = entries.len();
sender.send(entries).or(Err(()))?; sender.send(entries).or(Err(()))?;
inc_new_counter_info!("record_stage-txs", txs_len);
inc_new_counter_info!("record_stage-entries", entries_len);
Ok(()) Ok(())
} }

View File

@ -49,6 +49,8 @@ impl WriteStage {
} }
} }
inc_new_counter_info!("write_stage-write_entries", entries.len());
//TODO(anatoly): real stake based voting needs to change this //TODO(anatoly): real stake based voting needs to change this
//leader simply votes if the current set of validators have voted //leader simply votes if the current set of validators have voted
//on a valid last id //on a valid last id