From ef0d9dfe5d8e1d29041b4de85f644993950ab48c Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 4 May 2024 17:30:07 +0200 Subject: [PATCH] recording: add more logging --- src/stdlib/recording.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stdlib/recording.rs b/src/stdlib/recording.rs index 81cb3bd..8a07e1c 100644 --- a/src/stdlib/recording.rs +++ b/src/stdlib/recording.rs @@ -30,7 +30,7 @@ use core::fmt::{Display, Formatter}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use cpal::{BufferSize, StreamConfig}; use std::error::Error; -use std::time::Duration; +use std::time::{Duration, Instant}; #[derive(Debug)] // #[derive(Debug, Clone)] @@ -112,9 +112,13 @@ pub fn start_detector_thread( Duration::from_secs_f32(data.len() as f32 / sampling_rate).as_millis() ); + let now = Instant::now(); let beat = detector.update_and_detect_beat(data.iter().copied()); + let duration = now.elapsed(); + log::trace!("Beat detection took {:?}", duration); if let Some(beat) = beat { + log::debug!("Beat detection took {:?}", duration); on_beat_cb(beat); } },