fix: simplify diag_timer_cb — use pool->free_count instead of allocations-reuse
DIAG line now shows clear metrics: rq/wq — queue sizes ent_f/dat_f — free_count of entry/data pools (→0 = leak) wbuf — partial send stuck tcp_rb/tcp_sb — kernel socket buffers
This commit is contained in:
1 parent
dc2b394e7a
commit
a0da29f1eb
1 file changed
+8
-10
@@ -129,9 +129,8 @@ static void diag_timer_cb(void* arg) {
|
||||
struct tcp_conn* tc = rc->tc;
|
||||
if (!tc || tc->sock == SOCKET_INVALID) return;
|
||||
|
||||
size_t ea, er, da, dr;
|
||||
memory_pool_get_stats(tc->entry_pool, &ea, &er);
|
||||
memory_pool_get_stats(tc->data_pool, &da, &dr);
|
||||
int ent_f = tc->entry_pool->free_count;
|
||||
int dat_f = tc->data_pool->free_count;
|
||||
|
||||
int rcv_buf = 0, snd_buf = 0;
|
||||
socklen_t optlen = sizeof(int);
|
||||
@@ -139,16 +138,15 @@ static void diag_timer_cb(void* arg) {
|
||||
getsockopt(tc->sock, SOL_SOCKET, SO_SNDBUF, &snd_buf, &optlen);
|
||||
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET,
|
||||
"SOCK:DIAG fd=%d sid=%08x conn=%d err=%d fin=%d "
|
||||
"rpaused=%d wmon=%d rq=%d(%zdb) wq=%d(%zdb) wbuf=%s "
|
||||
"entry=%zd data=%zd tcp_rb=%d tcp_sb=%d",
|
||||
(int)tc->sock, rc->stream_id, tc->connected, tc->error, tc->fin,
|
||||
tc->read_paused, tc->write_monitor,
|
||||
"SOCK:DIAG fd=%d sid=%08x conn=%d fin=%d "
|
||||
"rq=%d(%zub) wq=%d(%zub) wbuf=%s "
|
||||
"ent_f=%d dat_f=%d tcp_rb=%zu tcp_sb=%zu",
|
||||
(int)tc->sock, rc->stream_id, tc->connected, tc->fin,
|
||||
tc->read_queue->count, queue_total_bytes(tc->read_queue),
|
||||
tc->write_queue->count, queue_total_bytes(tc->write_queue),
|
||||
tc->write_buf ? "y" : "n",
|
||||
(ssize_t)(ea - er), (ssize_t)(da - dr),
|
||||
rcv_buf, snd_buf);
|
||||
ent_f, dat_f,
|
||||
(size_t)rcv_buf, (size_t)snd_buf);
|
||||
|
||||
rc->diag_timer = uasync_set_timeout(rc->ua, 10000, rc, diag_timer_cb, "tps_diag");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user