perf: Reduce tracker CPU overhead with snaplen and longer sync interval

This commit is contained in:
SamNet-dev
2026-02-03 14:44:49 -06:00
parent 8c7f944d84
commit 8d86f0fd95

View File

@@ -1821,7 +1821,7 @@ while true; do
break break
fi fi
fi fi
done < <($TCPDUMP_BIN -tt -l -ni any -n -q "(tcp or udp) and not port 22" 2>/dev/null | $AWK_BIN -v local_ip="$LOCAL_IP" ' done < <($TCPDUMP_BIN -tt -l -ni any -n -q -s 96 "(tcp or udp) and not port 22" 2>/dev/null | $AWK_BIN -v local_ip="$LOCAL_IP" '
BEGIN { last_sync = 0; OFMT = "%.0f"; CONVFMT = "%.0f" } BEGIN { last_sync = 0; OFMT = "%.0f"; CONVFMT = "%.0f" }
{ {
# Parse timestamp # Parse timestamp
@@ -1867,9 +1867,9 @@ while true; do
to[dst] += len to[dst] += len
} }
# Sync every 15 seconds # Sync every 30 seconds
if (last_sync == 0) last_sync = ts if (last_sync == 0) last_sync = ts
if (ts - last_sync >= 15) { if (ts - last_sync >= 30) {
for (ip in from) { if (from[ip] > 0) print "FROM|" ip "|" from[ip] } for (ip in from) { if (from[ip] > 0) print "FROM|" ip "|" from[ip] }
for (ip in to) { if (to[ip] > 0) print "TO|" ip "|" to[ip] } for (ip in to) { if (to[ip] > 0) print "TO|" ip "|" to[ip] }
print "SYNC_MARKER" print "SYNC_MARKER"