1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-24 15:02:21 +01:00

Measure all mempool processing duration

This commit is contained in:
Roman Zeyde 2018-05-18 21:51:58 +03:00
parent 5300149c0a
commit 5118d8f7fa
No known key found for this signature in database
GPG key ID: 87CAE5FA46917CBB

View file

@ -54,11 +54,11 @@ impl Tracker {
}
pub fn update(&mut self, daemon: &Daemon) -> Result<()> {
let t = Instant::now();
let new_txids = HashSet::<Sha256dHash>::from_iter(daemon
.getmempooltxids()
.chain_err(|| "failed to update mempool from daemon")?);
let old_txids = HashSet::from_iter(self.stats.keys().cloned());
let t = Instant::now();
for txid in new_txids.difference(&old_txids) {
let entry = match daemon.getmempoolentry(txid) {
Ok(entry) => entry,
@ -82,10 +82,9 @@ impl Tracker {
for txid in old_txids.difference(&new_txids) {
self.remove(txid);
}
let dt = t.elapsed();
debug!(
"mempool update took {:.1} ms ({} txns)",
dt.in_seconds() * 1e3,
t.elapsed().in_seconds() * 1e3,
self.stats.len()
);
Ok(())