commit 3f782f677ce34ad5676fc8492afa58c513082b07 from: Thomas Böhler date: Tue Nov 22 09:41:05 2022 UTC Calculate throughput in kbit/s commit - 83a396e439e278ba96582a6e060db346c7f2b4eb commit + 3f782f677ce34ad5676fc8492afa58c513082b07 blob - 5d2514439a7abed37550f00b42a8ceac841dde6f blob + 19515e2fdecbf22ce1e5442cb93ce377ebc7cfbd --- src/main.rs +++ src/main.rs @@ -42,6 +42,7 @@ impl ThroughputState { } fn handle_buffer_write(payload: Vec) { + log::info!("handle_buffer_write {}", payload.len()); let mut state = STATE.lock().unwrap(); state.add_write_len(payload.len()); } @@ -97,13 +98,14 @@ fn main() { if ble_esp32c3::Ble::rssi().is_none() { log::info!("Currently not connected."); } else { + // TODO: can't handle different connections (will reuse previous STATE) let s = STATE.lock().unwrap(); let passed = s.get_time_passed().as_secs().max(1); let len = s.get_write_len(); log::info!( - "Throughput: {} ({} / {})", - len / passed as usize, + "Throughput: {} kbit/s ({} / {})", + (len * 8) / 1000 / passed as usize, len, passed );