async fn inner_main() -> anyhow::Result<()> { let client: HostClient = HostClient::new_raw_nusb( |d| d.serial_number() == Some("E4629076D33B0B22"), ERROR_PATH, 64, VarSeqKind::Seq1, ); let mut rng = thread_rng(); for sz in [32, 64, 128, 256, 512, 768] { let mut data = vec![0u8; sz]; rng.fill_bytes(&mut data); let data = UartFrame { data }; let mib = 1; let count = (mib * 1024 * 1024) / sz; println!("Doing {count} pkts, {sz}B each ({mib}MiB total)"); let start = Instant::now(); let mut out = Vec::with_capacity(count); for _i in 0..count { // if (i % 1024) == 0 { // println!("{i}"); // } let resp = client.send_resp::(&data).await.unwrap(); out.push(resp); } let taken = start.elapsed(); println!("Took {taken:?}"); for pkt in out { assert_eq!(pkt.data, data.data); } let mbps = (mib * 8) as f64 / taken.as_secs_f64(); println!("{mbps:.02}mbps up + {mbps:.02}mbps down"); } Ok(()) }