mirror of
https://github.com/romanz/electrs.git
synced 2025-02-24 23:08:39 +01:00
Measure all mempool processing duration
This commit is contained in:
parent
5300149c0a
commit
5118d8f7fa
1 changed files with 2 additions and 3 deletions
|
@ -54,11 +54,11 @@ impl Tracker {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self, daemon: &Daemon) -> Result<()> {
|
pub fn update(&mut self, daemon: &Daemon) -> Result<()> {
|
||||||
|
let t = Instant::now();
|
||||||
let new_txids = HashSet::<Sha256dHash>::from_iter(daemon
|
let new_txids = HashSet::<Sha256dHash>::from_iter(daemon
|
||||||
.getmempooltxids()
|
.getmempooltxids()
|
||||||
.chain_err(|| "failed to update mempool from daemon")?);
|
.chain_err(|| "failed to update mempool from daemon")?);
|
||||||
let old_txids = HashSet::from_iter(self.stats.keys().cloned());
|
let old_txids = HashSet::from_iter(self.stats.keys().cloned());
|
||||||
let t = Instant::now();
|
|
||||||
for txid in new_txids.difference(&old_txids) {
|
for txid in new_txids.difference(&old_txids) {
|
||||||
let entry = match daemon.getmempoolentry(txid) {
|
let entry = match daemon.getmempoolentry(txid) {
|
||||||
Ok(entry) => entry,
|
Ok(entry) => entry,
|
||||||
|
@ -82,10 +82,9 @@ impl Tracker {
|
||||||
for txid in old_txids.difference(&new_txids) {
|
for txid in old_txids.difference(&new_txids) {
|
||||||
self.remove(txid);
|
self.remove(txid);
|
||||||
}
|
}
|
||||||
let dt = t.elapsed();
|
|
||||||
debug!(
|
debug!(
|
||||||
"mempool update took {:.1} ms ({} txns)",
|
"mempool update took {:.1} ms ({} txns)",
|
||||||
dt.in_seconds() * 1e3,
|
t.elapsed().in_seconds() * 1e3,
|
||||||
self.stats.len()
|
self.stats.len()
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Reference in a new issue