代码拉取完成,页面将自动刷新
From 66f2015f6710d86966b8abcf028f69a3165c10aa Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Tue, 28 Nov 2023 18:43:42 +0800
Subject: [PATCH] dfx: add tcp exception and kernel event statistics
---
src/common/gazelle_dfx_msg.h | 4 ++++
src/lstack/api/lstack_epoll.c | 9 +++++++--
src/ltran/ltran_dfx.c | 7 ++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 8071108..bfc4992 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -75,6 +75,7 @@ struct gazelle_wakeup_stat {
uint64_t app_write_cnt;
uint64_t app_read_cnt;
uint64_t read_null;
+ uint64_t kernel_events;
};
struct gazelle_stat_pkts {
@@ -120,6 +121,9 @@ struct gazelle_stat_lstack_snmp {
uint32_t tcp_fin_ack_cnt;
uint32_t tcp_delay_ack_cnt;
uint32_t tcp_refused_cnt;
+ uint32_t tcp_out_of_seq;
+ uint32_t tcp_acceptmbox_full;
+ uint32_t tcp_listen_drops;
/* UDP */
uint32_t udp_in_datagrams;
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 2cb459e..a2d2a9b 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -493,7 +493,6 @@ int32_t epoll_lwip_event_nolock(struct wakeup_poll *wakeup, struct epoll_event *
}
}
- wakeup->stat.app_events += event_num;
return event_num;
}
@@ -611,6 +610,7 @@ int32_t lstack_rtc_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
lwip_num = epoll_lwip_event_nolock(wakeup, &events[kernel_num], tmpmaxevents - kernel_num);
wakeup->stat.app_events += lwip_num;
+ wakeup->stat.kernel_events += kernel_num;
return lwip_num + kernel_num;
}
@@ -634,7 +634,6 @@ int32_t lstack_rtw_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
do {
__atomic_store_n(&wakeup->in_wait, true, __ATOMIC_RELEASE);
lwip_num = epoll_lwip_event(wakeup, events, maxevents);
- wakeup->stat.app_events += lwip_num;
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
kernel_num = posix_api->epoll_wait_fn(epfd, &events[lwip_num], maxevents - lwip_num, 0);
@@ -661,6 +660,9 @@ int32_t lstack_rtw_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t
} while (ret == 0);
__atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
+ wakeup->stat.app_events += lwip_num;
+ wakeup->stat.kernel_events += kernel_num;
+
return lwip_num + kernel_num;
}
@@ -870,6 +872,9 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
} while (ret == 0);
__atomic_store_n(&wakeup->in_wait, false, __ATOMIC_RELEASE);
+ wakeup->stat.app_events += lwip_num;
+ wakeup->stat.kernel_events += kernel_num;
+
return lwip_num + kernel_num;
}
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 98e23dc..3bd120c 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -604,7 +604,9 @@ static void show_lstack_stats(struct gazelle_stack_dfx_data *lstack_stat)
printf("write_lwip: %-17"PRIu64" ", lstack_stat->data.pkts.stack_stat.write_lwip_cnt);
printf("app_write_rpc: %-14"PRIu64" \n", lstack_stat->data.pkts.wakeup_stat.app_write_rpc);
printf("recv_list: %-18"PRIu64" ", lstack_stat->data.pkts.recv_list_cnt);
- printf("conn_num: %-19hu \n", lstack_stat->data.pkts.conn_num);
+ printf("conn_num: %-19hu ", lstack_stat->data.pkts.conn_num);
+
+ printf("kernel_events: %-14"PRIu64"\n", lstack_stat->data.pkts.wakeup_stat.kernel_events);
printf("wakeup_events: %-14"PRIu64" ", lstack_stat->data.pkts.stack_stat.wakeup_events);
printf("app_events: %-17"PRIu64" ", lstack_stat->data.pkts.wakeup_stat.app_events);
printf("read_null: %-18"PRIu64" \n", lstack_stat->data.pkts.wakeup_stat.read_null);
@@ -839,6 +841,9 @@ static void gazelle_print_lstack_tcp_stat(const struct gazelle_stat_lstack_snmp
printf("tcp_fin_ack_cnt: %u\n", snmp->tcp_fin_ack_cnt);
printf("tcp_delay_ack_cnt: %u\n", snmp->tcp_delay_ack_cnt);
printf("tcp_refused_cnt: %u\n", snmp->tcp_refused_cnt);
+ printf("tcp_out_of_seq: %u\n", snmp->tcp_out_of_seq);
+ printf("tcp_acceptmbox_full: %u\n", snmp->tcp_acceptmbox_full);
+ printf("tcp_listen_drops: %u\n", snmp->tcp_listen_drops);
}
static void gazelle_print_lstack_stat_snmp_core(const struct gazelle_stack_dfx_data *stat,
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。