代码拉取完成,页面将自动刷新
From 53457e3ab329eb944579ffe55ddc4435e0bca0a1 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Wed, 10 Jan 2024 09:12:34 +0800
Subject: [PATCH] add socket accept fail cnt
---
src/common/gazelle_dfx_msg.h | 1 +
src/lstack/core/lstack_protocol_stack.c | 2 ++
src/ltran/ltran_dfx.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 478c440..1d3249d 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -72,6 +72,7 @@ struct gazelle_stack_stat {
uint64_t tx_drop;
uint64_t tx;
uint64_t tx_prepare_fail;
+ uint64_t accept_fail;
};
struct gazelle_wakeup_stat {
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index f849bcd..0d845dd 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -792,9 +792,11 @@ void stack_accept(struct rpc_msg *msg)
{
int32_t fd = msg->args[MSG_ARG_0].i;
msg->result = -1;
+ struct protocol_stack *stack = get_protocol_stack();
int32_t accept_fd = lwip_accept4(fd, msg->args[MSG_ARG_1].p, msg->args[MSG_ARG_2].p, msg->args[MSG_ARG_3].i);
if (accept_fd < 0) {
+ stack->stats.accept_fail++;
LSTACK_LOG(ERR, LSTACK, "fd %d ret %d\n", fd, accept_fd);
return;
}
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 5e22e20..461912f 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -646,6 +646,7 @@ static void show_lstack_stats(struct gazelle_stack_dfx_data *lstack_stat)
printf("send_pkts_fail: %-13"PRIu64" ", lstack_stat->data.pkts.stack_stat.send_pkts_fail);
printf("mbuf_pool_freecnt: %-10"PRIu32" ", lstack_stat->data.pkts.mbufpool_avail_cnt);
printf("rpc_pool_freecnt: %-12"PRIu32" \n", lstack_stat->data.pkts.rpcpool_avail_cnt);
+ printf("accpet_fail: %-12"PRIu64" \n", lstack_stat->data.pkts.stack_stat.accept_fail);
}
static void gazelle_print_lstack_stat_detail(struct gazelle_stack_dfx_data *lstack_stat,
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。