1 Star 0 Fork 32

hantwofish/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0063-dfx-add-tcp-exception-and-kernel-event-statistics.patch 4.37 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2023-11-29 15:01 . sync support vlan offload
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/gazelle_1.git
git@gitee.com:hantwofish/gazelle_1.git
hantwofish
gazelle_1
gazelle_1
master

搜索帮助