From 8d79b070ebf5e3e13c64a853b3dc08596132e0fb Mon Sep 17 00:00:00 2001 From: joecryptotoo <80373433+joecryptotoo@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:35:45 -0700 Subject: [PATCH] measure and log poc durations --- src/beaconer.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/beaconer.rs b/src/beaconer.rs index 8250e69b..dc206fd9 100644 --- a/src/beaconer.rs +++ b/src/beaconer.rs @@ -206,9 +206,13 @@ impl Beaconer { &self, packet: PacketUp, ) -> Result { + let mut total_duration = Duration::new(0, 0); + let start = Instant::now(); let mut report = poc_lora::LoraWitnessReportReqV1::try_from(packet)?; report.pub_key = self.keypair.public_key().to_vec(); report.signature = sign(self.keypair.clone(), report.encode_to_vec()).await?; + total_duration += start.elapsed(); + info!("signing took {:?}", total_duration); Ok(report) } @@ -252,11 +256,15 @@ impl Beaconer { match tokio::try_join!(report_fut, service_fut) { Ok((report, mut poc_service)) => { let beacon_id = report.data.to_b64(); + let mut total_duration = Duration::new(0, 0); + let start = Instant::now(); let _ = poc_service .submit_witness(report) .inspect_err(|err| warn!(beacon_id, %err, "submit poc witness report")) .inspect_ok(|_| info!(beacon_id, "poc witness report submitted")) .await; + total_duration += start.elapsed(); + info!("poc submission took {:?}", total_duration); } Err(err) => { warn!(%err, "poc witness report");