From 57cc9922a4cde5eecb09c0f17685d2c7b5cc472e Mon Sep 17 00:00:00 2001 From: fanyang Date: Sun, 28 Jun 2026 18:31:25 +0800 Subject: [PATCH] hotpath: add measure to MpscTunnelSender::send and send_msg_by_ip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds hotpath::measure to two critical blind spots in the send chain: 1. MpscTunnelSender::send — the tokio mpsc channel send point, which accounts for 84% of PeerConn::send_msg wall time (2.33us/pkt). 2. PeerManager::send_msg_by_ip — the top-level packet send entry point, revealing a 1.04us gap between send_msg_by_ip and send_msg_internal (encryption + routing + ACL + fan-out). Full send chain timing now visible: send_msg_by_ip: 3.83us └─ send_msg_internal: 2.79us (gap: 1.04us = encrypt + route + ACL) └─ MpscTunnelSender::send: 2.33us (84% of internal) --- easytier/src/peers/peer_manager.rs | 1 + easytier/src/tunnel/mpsc.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/easytier/src/peers/peer_manager.rs b/easytier/src/peers/peer_manager.rs index e081995a..f85beaef 100644 --- a/easytier/src/peers/peer_manager.rs +++ b/easytier/src/peers/peer_manager.rs @@ -1718,6 +1718,7 @@ impl PeerManager { Ok(()) } + #[cfg_attr(feature = "hotpath", hotpath::measure(impl_type = "PeerManager"))] pub async fn send_msg_by_ip( &self, mut msg: ZCPacket, diff --git a/easytier/src/tunnel/mpsc.rs b/easytier/src/tunnel/mpsc.rs index 32c2dcfa..e131d66b 100644 --- a/easytier/src/tunnel/mpsc.rs +++ b/easytier/src/tunnel/mpsc.rs @@ -19,6 +19,7 @@ use futures::SinkExt; pub struct MpscTunnelSender(Sender); impl MpscTunnelSender { + #[cfg_attr(feature = "hotpath", hotpath::measure(impl_type = "MpscTunnelSender"))] pub async fn send(&self, item: ZCPacket) -> Result<(), TunnelError> { match self.0.try_send(item) { Ok(()) => Ok(()),