hotpath: add measure to MpscTunnelSender::send and send_msg_by_ip

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)
This commit is contained in:
fanyang
2026-06-28 18:31:25 +08:00
parent 4875393327
commit 57cc9922a4
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -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,
+1
View File
@@ -19,6 +19,7 @@ use futures::SinkExt;
pub struct MpscTunnelSender(Sender<ZCPacket>);
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(()),