diff options
| author | 杨威 <[email protected]> | 2019-01-27 13:52:03 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2019-01-27 13:52:03 +0800 |
| commit | b4301a61c53e1f84c858a42eac08926159a1fa89 (patch) | |
| tree | a0ca9e359de3a2e61a6540a3192a457b98d315ca | |
| parent | ae760339427abe885608cb2469df3af2557b3e11 (diff) | |
| parent | 00126d6f6a150806ab6e033f50fe67027c3abf91 (diff) | |
Merge branch 'Feature-serial-special-timeout-sysinfo' into 'pangu_develop_serial'
1、sysinfo增加对单独设置timeout的流计数
See merge request MESA_Platform/sapp!5
| -rw-r--r-- | entry/sapp_global_val.c | 315 | ||||
| -rw-r--r-- | packet_io/packet_io_status.cpp | 84 |
2 files changed, 207 insertions, 192 deletions
diff --git a/entry/sapp_global_val.c b/entry/sapp_global_val.c index c08c9a0..84b2fd3 100644 --- a/entry/sapp_global_val.c +++ b/entry/sapp_global_val.c @@ -1,155 +1,160 @@ -#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "stream.h"
-#include "stream_internal.h"
-#include "packet_io_internal.h"
-#include "mesa_net.h"
-#include "sysinfo.h"
-#include "stream_manage.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-struct sapp_global_single_t sapp_global_single;
-struct sapp_global_mthread_t sapp_global_mthread[MAX_THREAD_NUM];
-extern int g_packet_io_thread_num;
-extern int tcpstate_num[MAX_TCP_STATE];
-extern int udpstate_num[MAX_UDP_STATE];
-
-extern char *MESA_MD5_sum_str(unsigned char *raw_data, unsigned int raw_data_len, char result[33]);
-
-static off_t _check_hdr_get_file_length(const char *file_name)
-{
- struct stat file_stat;
-
- if(stat(file_name, &file_stat) == 0)
- {
- return file_stat.st_size;
- }
- return 0;
-}
-
-static void sapp_include_header_check_file(const char *file_name, const char *std_md5_sum_str)
-{
- char file_md5_sum_str[33];
- FILE *fp;
- char *tmp_file_buf;
- off_t file_len;
-
- fp = fopen(file_name, "r");
- if(NULL == fp){
- return;
- }
-
- file_len = _check_hdr_get_file_length(file_name);
- tmp_file_buf = (char *)malloc(file_len);
-
- fread(tmp_file_buf, file_len, 1, fp);
-
- MESA_MD5_sum_str((unsigned char *)tmp_file_buf, file_len, file_md5_sum_str);
-
- if(memcmp(file_md5_sum_str, std_md5_sum_str, 32) != 0){
- printf("\033[33m[Warning]stream_inc header file %s is disaccord with current sapp!\033[0m\n", file_name);
- usleep(200 * 1000);
- }
-
- fclose(fp);
- free(tmp_file_buf);
-
- return;
-}
-
-/* ��ǰ���л����µ�.h����뻷���Ƿ�һ�� */
-void sapp_include_header_check(void)
-{
- const char *hdr_dir;
- char tmp_file_path[1024];
-
- hdr_dir = "/opt/MESA/include/MESA/stream_inc";
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_base.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_BASE_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_entry.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_ENTRY_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_inject.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_INJECT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_project.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_PROJECT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_proxy.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_PROXY_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_rawpkt.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_RAWPKT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_tunnel.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_TUNNEL_MD5_CHECK);
-
- hdr_dir = "/usr/include/MESA/stream_inc";
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_base.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_BASE_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_entry.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_ENTRY_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_inject.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_INJECT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_project.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_PROJECT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_proxy.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_PROXY_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_rawpkt.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_RAWPKT_MD5_CHECK);
-
- snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_tunnel.h");
- sapp_include_header_check_file(tmp_file_path, STREAM_TUNNEL_MD5_CHECK);
-}
-
-
-void sapp_global_val_check(void)
-{
- /* ���߳�ȫ�ֱ���������64�ֽ�������, ����cache�����ͻ, ����Ӱ������ */
- if((sizeof(struct sapp_global_mthread_t) % 64) != 0){
- printf("\033[1;31;40msizeof(struct sapp_global_mthread_t)=%u, is not multiple of 64B!\033[0m\n", sizeof(struct sapp_global_mthread_t));
- abort();
- }
-
- if((sizeof(layer_args_t) % 64) != 0){
- printf("\033[1;31;40msizeof(struct layer_args_t)=%u, is not multiple of 64B!\033[0m\n", sizeof(layer_args_t));
- abort();
- }
-
- sapp_include_header_check();
-
- if(INDEPENDENT_SEND_QUEUE_MAX_NUM > MAX_THREAD_NUM){
- printf("\033[1;31;40m INDEPENDENT_SEND_QUEUE_MAX_NUM(%d) > MAX_THREAD_NUM(%d)!\033[0m\n", INDEPENDENT_SEND_QUEUE_MAX_NUM, MAX_THREAD_NUM);
- abort();
- }
-}
-
-int sapp_global_val_init(void)
-{
- int i;
-
- sapp_global_val_check();
-
- for(i = 0; i < g_packet_io_thread_num; i++){
- sapp_global_mthread[i].tcp_stream_special_timeout_num = tcpstate_num[TCP_DATA_STATE]/10 + 1;
- sapp_global_mthread[i].udp_stream_special_timeout_num = udpstate_num[UDP_TWO_STATE]/10 + 1;
- }
-
- return 0;
-}
-#ifdef __cplusplus
-}
-#endif
-
+#ifdef __cplusplus +extern "C" { +#endif + +#include "stream.h" +#include "stream_internal.h" +#include "packet_io_internal.h" +#include "mesa_net.h" +#include "sysinfo.h" +#include "stream_manage.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +struct sapp_global_single_t sapp_global_single; +struct sapp_global_mthread_t sapp_global_mthread[MAX_THREAD_NUM]; +extern int g_packet_io_thread_num; +extern int tcpstate_num[MAX_TCP_STATE]; +extern int udpstate_num[MAX_UDP_STATE]; + +extern char *MESA_MD5_sum_str(unsigned char *raw_data, unsigned int raw_data_len, char result[33]); + +static off_t _check_hdr_get_file_length(const char *file_name) +{ + struct stat file_stat; + + if(stat(file_name, &file_stat) == 0) + { + return file_stat.st_size; + } + return 0; +} + +static void sapp_include_header_check_file(const char *file_name, const char *std_md5_sum_str) +{ + char file_md5_sum_str[33]; + FILE *fp; + char *tmp_file_buf; + off_t file_len; + + fp = fopen(file_name, "r"); + if(NULL == fp){ + return; + } + + file_len = _check_hdr_get_file_length(file_name); + tmp_file_buf = (char *)malloc(file_len); + + fread(tmp_file_buf, file_len, 1, fp); + + MESA_MD5_sum_str((unsigned char *)tmp_file_buf, file_len, file_md5_sum_str); + + if(memcmp(file_md5_sum_str, std_md5_sum_str, 32) != 0){ + printf("\033[33m[Warning]stream_inc header file %s is disaccord with current sapp!\033[0m\n", file_name); + usleep(200 * 1000); + } + + fclose(fp); + free(tmp_file_buf); + + return; +} + +/* ��ǰ���л����µ�.h����뻷���Ƿ�һ�� */ +void sapp_include_header_check(void) +{ + const char *hdr_dir; + char tmp_file_path[1024]; + + hdr_dir = "/opt/MESA/include/MESA/stream_inc"; + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_base.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_BASE_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_entry.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_ENTRY_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_inject.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_INJECT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_project.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_PROJECT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_proxy.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_PROXY_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_rawpkt.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_RAWPKT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_tunnel.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_TUNNEL_MD5_CHECK); + + hdr_dir = "/usr/include/MESA/stream_inc"; + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_base.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_BASE_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_entry.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_ENTRY_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_inject.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_INJECT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_project.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_PROJECT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_proxy.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_PROXY_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_rawpkt.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_RAWPKT_MD5_CHECK); + + snprintf(tmp_file_path, 1024, "%s/%s", hdr_dir, "stream_tunnel.h"); + sapp_include_header_check_file(tmp_file_path, STREAM_TUNNEL_MD5_CHECK); +} + + +void sapp_global_val_check(void) +{ + /* ���߳�ȫ�ֱ���������64�ֽ�������, ����cache�����ͻ, ����Ӱ������ */ + if((sizeof(struct sapp_global_mthread_t) % 64) != 0){ + printf("\033[1;31;40msizeof(struct sapp_global_mthread_t)=%u, is not multiple of 64B!\033[0m\n", sizeof(struct sapp_global_mthread_t)); + abort(); + } + + if((sizeof(layer_args_t) % 64) != 0){ + printf("\033[1;31;40msizeof(struct layer_args_t)=%u, is not multiple of 64B!\033[0m\n", sizeof(layer_args_t)); + abort(); + } + + sapp_include_header_check(); + + if(INDEPENDENT_SEND_QUEUE_MAX_NUM > MAX_THREAD_NUM){ + printf("\033[1;31;40m INDEPENDENT_SEND_QUEUE_MAX_NUM(%d) > MAX_THREAD_NUM(%d)!\033[0m\n", INDEPENDENT_SEND_QUEUE_MAX_NUM, MAX_THREAD_NUM); + abort(); + } +} + +int sapp_global_val_init(void) +{ + int i; + + sapp_global_val_check(); + +#if 0 + int i; + for(i = 0; i < g_packet_io_thread_num; i++){ + sapp_global_mthread[i].tcp_stream_special_timeout_num = tcpstate_num[TCP_DATA_STATE]/10 + 1; + sapp_global_mthread[i].udp_stream_special_timeout_num = udpstate_num[UDP_TWO_STATE]/10 + 1; + } +#endif + + return 0; +} + + +#ifdef __cplusplus +} +#endif + diff --git a/packet_io/packet_io_status.cpp b/packet_io/packet_io_status.cpp index f55907b..98f0cf3 100644 --- a/packet_io/packet_io_status.cpp +++ b/packet_io/packet_io_status.cpp @@ -35,6 +35,8 @@ extern void sapp_statsd_flush_buf(void); extern void sapp_fs2_update(int field_index, unsigned long long value); extern int top_mode; extern int cap_mode; +extern struct sapp_global_mthread_t sapp_global_mthread[MAX_THREAD_NUM]; + /* ת���������������������ַ���, ��123bps, 34.5Mbps */ static char *byte_convert_human(unsigned long long bytes, int interval, int multiple, char * byte_str) { @@ -184,38 +186,45 @@ void sysinfo_output(void) } } - fprintf(fp,"\n------------------------------- TCP statistics detail -----------------------------\n"); - fprintf(fp,"%3s %-27s %-19s %-27s\n", "", "|-----------Current---------|", "|------Realtime-----|", "|--------From-of-startup---------|"); - fprintf(fp,"%3s %8s %9s %10s %10s %10s %10s %9s %13s\n", "tid", "link-syn", "link-data", "link-nouse", "link-new/s", "link-del/s", "stream-num", "reset-num", "hash-list-max"); - for(i = 0; i < g_packet_io_thread_num; i++){ - fprintf(fp, "%3d %8llu %9llu %10llu %10llu %10llu %10llu %9llu %13llu\n", - i, - g_SysInputInfo[i][SYS_TCP_LINK_SYN], - g_SysInputInfo[i][SYS_TCP_LINK_DATA], - g_SysInputInfo[i][SYS_TCP_LINK_NOUSE], - (g_SysInputInfo[i][SYS_TCP_LINK_NEW]-g_SysInputInfo_old[i][SYS_TCP_LINK_NEW]), - (g_SysInputInfo[i][SYS_TCP_LINK_DEL]-g_SysInputInfo_old[i][SYS_TCP_LINK_DEL]), - g_SysInputInfo[i][SYS_TCP_LINK_NEW], - g_SysInputInfo[i][SYS_TCP_LINK_RESET], - g_SysInputInfo[i][SYS_HASH_LIST_MAX]); - } + fprintf(fp,"\n------------------------------- TCP statistics detail -----------------------------\n"); + fprintf(fp,"%3s %-27s %-19s %-27s %-27s\n", "", "|-----------Current---------|", "|------Realtime-----|", + "|--------From-of-startup---------|", "|--------Special---------|"); + fprintf(fp,"%3s %8s %9s %10s %10s %10s %10s %9s %13s %17s\n", "tid", "link-syn", "link-data", "link-nouse", + "link-new/s", "link-del/s", "stream-num", "reset-num", "hash-list-max", "special-timeout"); + for(i = 0; i < g_packet_io_thread_num; i++){ + fprintf(fp, "%3d %8llu %9llu %10llu %10llu %10llu %10llu %9llu %13llu %13llu\n", + i, + g_SysInputInfo[i][SYS_TCP_LINK_SYN], + g_SysInputInfo[i][SYS_TCP_LINK_DATA], + g_SysInputInfo[i][SYS_TCP_LINK_NOUSE], + (g_SysInputInfo[i][SYS_TCP_LINK_NEW]-g_SysInputInfo_old[i][SYS_TCP_LINK_NEW]), + (g_SysInputInfo[i][SYS_TCP_LINK_DEL]-g_SysInputInfo_old[i][SYS_TCP_LINK_DEL]), + g_SysInputInfo[i][SYS_TCP_LINK_NEW], + g_SysInputInfo[i][SYS_TCP_LINK_RESET], + g_SysInputInfo[i][SYS_HASH_LIST_MAX], + sapp_global_mthread[i].tcp_stream_special_timeout_num); + } - fprintf(fp,"\n-------------------------- UDP statistics detail ------------------------\n"); - fprintf(fp,"%3s %-27s %-19s %-20s\n", " ", "|-----------Current---------|", "|------Realtime-----|", "|--From-of-startup--|"); - fprintf(fp,"%3s %8s %9s %10s %10s %10s %10s %9s\n", "tid", "link-one", "link-two", "link-more", "link-new/s", "link-del/s", "stream-num", "reset-num"); - for(i = 0; i < g_packet_io_thread_num; i++){ - fprintf(fp, "%3d %8llu %9llu %10llu %10llu %10llu %10llu %9llu\n", - i, - g_SysInputInfo[i][SYS_UDP_LINK_ONE], - g_SysInputInfo[i][SYS_UDP_LINK_TWO], - g_SysInputInfo[i][SYS_UDP_LINK_MORE], - (g_SysInputInfo[i][SYS_UDP_LINK_NEW]-g_SysInputInfo_old[i][SYS_UDP_LINK_NEW]), - (g_SysInputInfo[i][SYS_UDP_LINK_DEL]-g_SysInputInfo_old[i][SYS_UDP_LINK_DEL]), - g_SysInputInfo[i][SYS_UDP_LINK_NEW], - g_SysInputInfo[i][SYS_UDP_LINK_RESET]); - } - - fprintf(fp,"*****************************************************************\n\n"); + fprintf(fp,"\n-------------------------- UDP statistics detail ------------------------\n"); + fprintf(fp,"%3s %-27s %-19s %-20s %-20s\n", " ", "|-----------Current---------|", "|------Realtime-----|", + "|--From-of-startup--|", "|--------Special---------|"); + fprintf(fp,"%3s %8s %9s %10s %10s %10s %10s %9s %17s\n", "tid", "link-one", "link-two", "link-more", "link-new/s", + "link-del/s", "stream-num", "reset-num", "special-timeout"); + for(i = 0; i < g_packet_io_thread_num; i++){ + fprintf(fp, "%3d %8llu %9llu %10llu %10llu %10llu %10llu %9llu %13llu\n", + i, + g_SysInputInfo[i][SYS_UDP_LINK_ONE], + g_SysInputInfo[i][SYS_UDP_LINK_TWO], + g_SysInputInfo[i][SYS_UDP_LINK_MORE], + (g_SysInputInfo[i][SYS_UDP_LINK_NEW]-g_SysInputInfo_old[i][SYS_UDP_LINK_NEW]), + (g_SysInputInfo[i][SYS_UDP_LINK_DEL]-g_SysInputInfo_old[i][SYS_UDP_LINK_DEL]), + g_SysInputInfo[i][SYS_UDP_LINK_NEW], + g_SysInputInfo[i][SYS_UDP_LINK_RESET], + sapp_global_mthread[i].udp_stream_special_timeout_num); + } + + + fprintf(fp,"*****************************************************************\n\n"); fprintf(fp,"################# \033[41m%s\033[0m --- is same as above! #########\n", "sysinfo humanly"); fprintf(fp,"%-10s %12s %12s %12s %12s\n", "RCV-PKT", "total_pkt", "total_len","pps", "bps"); fprintf(fp,"%-10s %12llu %12s %12llu %12s\n","Ethernet",sysinfo_new[PKT_ETHERNET],byte_convert_human(sysinfo_new[PKT_ETHERNET_LEN],1 ,1,s1),(sysinfo_new[PKT_ETHERNET]-sysinfo_old[PKT_ETHERNET]),byte_convert_human((sysinfo_new[PKT_ETHERNET_LEN]-sysinfo_old[PKT_ETHERNET_LEN]),1,8,s2)); @@ -224,12 +233,6 @@ void sysinfo_output(void) fprintf(fp,"%-10s %12llu %12s %12llu %12s\n","TCP",sysinfo_new[PKT_TCP],byte_convert_human(sysinfo_new[PKT_TCPLEN],1,1,s1),(sysinfo_new[PKT_TCP]-sysinfo_old[PKT_TCP]),byte_convert_human((sysinfo_new[PKT_TCPLEN]-sysinfo_old[PKT_TCPLEN]),1,8,s2)); fprintf(fp,"%-10s %12llu %12s %12llu %12s\n","UDP",sysinfo_new[PKT_UDP],byte_convert_human(sysinfo_new[PKT_UDPLEN],1,1,s1),(sysinfo_new[PKT_UDP]-sysinfo_old[PKT_UDP]),byte_convert_human((sysinfo_new[PKT_UDPLEN]-sysinfo_old[PKT_UDPLEN]),1,8,s2)); fprintf(fp,"%-10s %12llu %12s %12llu %12s\n","Unknown",sysinfo_new[PKT_UNKNOWN],byte_convert_human(sysinfo_new[PKT_UNKNOWN_LEN],1,1,s1),(sysinfo_new[PKT_UNKNOWN]-sysinfo_old[PKT_UNKNOWN]),byte_convert_human((sysinfo_new[PKT_UNKNOWN_LEN]-sysinfo_old[PKT_UNKNOWN_LEN]),1,8,s2)); - fprintf(fp,"#################################################################\n"); - fprintf(fp,"%-10s %12s %12s %12s %12s\n","SND-PKT", "total_pkt", "total_len","pps", "bps"); - fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "TCP_RST", sysinfo_new[SEND_TCP_RST], byte_convert_human(sysinfo_new[SEND_TCP_RST_LEN], 1, 1, s1),(sysinfo_new[SEND_TCP_RST]-sysinfo_old[SEND_TCP_RST]), byte_convert_human((sysinfo_new[SEND_TCP_RST_LEN]-sysinfo_old[SEND_TCP_RST_LEN]), 1,8,s2)); - fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "TCP_S/A", sysinfo_new[SEND_TCP_SYN_ACK], byte_convert_human(sysinfo_new[SEND_TCP_SYN_ACK_LEN], 1, 1, s1),(sysinfo_new[SEND_TCP_SYN_ACK]-sysinfo_old[SEND_TCP_SYN_ACK]), byte_convert_human((sysinfo_new[SEND_TCP_SYN_ACK_LEN]-sysinfo_old[SEND_TCP_SYN_ACK_LEN]),1,8,s2)); - fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "UDP", sysinfo_new[SEND_UDP_PKT], byte_convert_human(sysinfo_new[SEND_UDP_PKT_LEN],1,1,s1),(sysinfo_new[SEND_UDP_PKT]-sysinfo_old[SEND_UDP_PKT]), byte_convert_human((sysinfo_new[SEND_UDP_PKT_LEN]-sysinfo_old[SEND_UDP_PKT_LEN]),1,8,s2)); - fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "SEND-ERR", sysinfo_new[SEND_PKT_ERR], byte_convert_human(sysinfo_new[SEND_PKT_ERR_LEN],1,1,s1),(sysinfo_new[SEND_PKT_ERR]-sysinfo_old[SEND_PKT_ERR]), byte_convert_human((sysinfo_new[SEND_PKT_ERR_LEN]-sysinfo_old[SEND_PKT_ERR_LEN]),1,8,s2)); fprintf(fp,"#################################################################\n"); @@ -247,6 +250,13 @@ void sysinfo_output(void) fprintf(fp,"%-10s %12llu %12llu\n", "TCP_S2C", sysinfo_new[LINK_SINGLE_S2C], sysinfo_new[LINK_SINGLE_S2C] - sysinfo_old[LINK_SINGLE_S2C]); + fprintf(fp,"#################################################################\n"); + fprintf(fp,"%-10s %12s %12s %12s %12s\n","SND-PKT", "total_pkt", "total_len","pps", "bps"); + fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "TCP_RST", sysinfo_new[SEND_TCP_RST], byte_convert_human(sysinfo_new[SEND_TCP_RST_LEN], 1, 1, s1),(sysinfo_new[SEND_TCP_RST]-sysinfo_old[SEND_TCP_RST]), byte_convert_human((sysinfo_new[SEND_TCP_RST_LEN]-sysinfo_old[SEND_TCP_RST_LEN]), 1,8,s2)); + fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "TCP_S/A", sysinfo_new[SEND_TCP_SYN_ACK], byte_convert_human(sysinfo_new[SEND_TCP_SYN_ACK_LEN], 1, 1, s1),(sysinfo_new[SEND_TCP_SYN_ACK]-sysinfo_old[SEND_TCP_SYN_ACK]), byte_convert_human((sysinfo_new[SEND_TCP_SYN_ACK_LEN]-sysinfo_old[SEND_TCP_SYN_ACK_LEN]),1,8,s2)); + fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "UDP", sysinfo_new[SEND_UDP_PKT], byte_convert_human(sysinfo_new[SEND_UDP_PKT_LEN],1,1,s1),(sysinfo_new[SEND_UDP_PKT]-sysinfo_old[SEND_UDP_PKT]), byte_convert_human((sysinfo_new[SEND_UDP_PKT_LEN]-sysinfo_old[SEND_UDP_PKT_LEN]),1,8,s2)); + fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "SEND-ERR", sysinfo_new[SEND_PKT_ERR], byte_convert_human(sysinfo_new[SEND_PKT_ERR_LEN],1,1,s1),(sysinfo_new[SEND_PKT_ERR]-sysinfo_old[SEND_PKT_ERR]), byte_convert_human((sysinfo_new[SEND_PKT_ERR_LEN]-sysinfo_old[SEND_PKT_ERR_LEN]),1,8,s2)); + fprintf(fp,"#################################################################\n\n"); /* 2018-08-29 lijia add field statsd */ |
