summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨威 <[email protected]>2019-09-05 11:55:57 +0800
committer杨威 <[email protected]>2019-09-05 11:55:57 +0800
commitad83a59e10bb8190c832f5e2eb87a79e39848ba9 (patch)
treed54cc59b04402701145f8e3632ba0a05f40b68af
parent7943cef7e5b723821c40e59b9b78dc6ac13d03c2 (diff)
Feature serial cherry pick from parallel
-rw-r--r--.gitignore5
-rw-r--r--CMakeLists.txt116
-rw-r--r--dealpkt/callapp.c8
-rw-r--r--include/sysinfo.h5
-rw-r--r--inner_plug/sapp_assistant.cpp8
-rw-r--r--packet_io/packet_io_marsio.c98
-rw-r--r--packet_io/packet_io_status.cpp39
7 files changed, 170 insertions, 109 deletions
diff --git a/.gitignore b/.gitignore
index 0de9cfc..bac1df8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,8 @@ build/
run/log/
run/sapp
version.txt
+.vscode
+cmake-build-debug
+GPATH
+GRTAGS
+GTAGS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d7cb89..6d9eac3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,12 @@ include(Version)
set(CMAKE_MACOSX_RPATH 0)
+set(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING
+ " set CMAKE_BUILD_TYPE chosen by the user, using DEBUG as default")
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS DEBUG RELEASE
+ RELWITHDEBINFO MINSIZEREL)
+
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLINK_MODE_DYNAMIC=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINK_MODE_DYNAMIC=1")
@@ -19,69 +25,58 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
endif()
-#set(CMAKE_INSTALL_PREFIX /home/ceiec/sapp/)
set(CMAKE_INSTALL_PREFIX /home/mesasoft/sapp_run/)
-option(PLATFORM_MODE_SERIAL "Using serial mode" TRUE)
+
+set(PLATFORM_MODE "INLINE" CACHE STRING
+ " set platform mode chosen by the user, using mirror as default")
+set_property(CACHE PLATFORM_MODE PROPERTY STRINGS MIRROR INLINE)
+message(STATUS "PLATFORM_MODE='${PLATFORM_MODE}'")
#static link option
option(ENABLE_STATIC_LINK "Enable static link" TRUE)
+# CPU profiler
+set(CPU_PROFILE "OFF" CACHE STRING
+ " set cpu profiler chosen by the user, using OFF as default")
+set_property(CACHE CPU_PROFILE PROPERTY STRINGS OFF GPERF GPROF)
+message(STATUS "CPU_PROFILE='${CPU_PROFILE}'")
+if(CPU_PROFILE MATCHES "GPERF")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lprofiler")
+elseif(CPU_PROFILE MATCHES "GPROF")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpg")
+endif()
+
#ASAN option
-option(ENABLE_SANITIZE_ADDRESS "Enable AddressSanitizer" FALSE)
-option(ENABLE_SANITIZE_THREAD "Enable ThreadSanitizer" FALSE)
+set(ASAN_OPTION "OFF" CACHE STRING
+ " set asan type chosen by the user, using OFF as default")
+set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD)
+message(STATUS "ASAN_OPTION='${ASAN_OPTION}'")
-if(ENABLE_SANITIZE_ADDRESS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer")
+if(ASAN_OPTION MATCHES "ADDRESS")
+ set(CMAKE_C_FLAGS "${CMAKADDRESS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
-elseif(ENABLE_SANITIZE_THREAD)
+elseif(ASAN_OPTION MATCHES "THREAD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
endif()
+
+
# MESA SDK Root
set(MESA_SDK_PREFIX "/opt/MESA/" CACHE STRING "MESA Framework Prefix")
+
# Capture Mode
-option(OPT_IOMODE_PCAP "Capture network traffic with libpcap" ON)
-option(OPT_IOMODE_PAG "Capture network traffic with libpag" OFF)
-#option(OPT_IOMODE_PPF "Capture network traffic with libppf" OFF)
-#option(OPT_IOMODE_PFRING "Capture network traffic with PF-RING" OFF)
-#option(OPT_IOMODE_DPDK "Capture network traffic with DPDK" OFF)
-#option(OPT_IOMODE_PAG_N95 "Capture network traffic with N95" OFF)
-option(OPT_IOMODE_MARSIO "Capture network traffic with MARSIO" ON)
-
-if(OPT_IOMODE_PCAP)
- set(CAPTURE_MODE "PCAP")
-endif()
+set(CAPTURE_MODE "PCAP" CACHE STRING
+ "CAPTURE_MODE set Capture network traffic chosen by the user, using PCAP as default")
-#if(OPT_IOMODE_PAG)
-# set(CAPTURE_MODE "PAG")
-#endif()
-#
-#if(OPT_IOMODE_PPF)
-# set(CAPTURE_MODE "PPF")
-#endif()
-#
-#if(OPT_IOMODE_PFRING)
-# set(CAPTURE_MODE "PFRING")
-#endif()
-#
-#if(OPT_IOMODE_DPDK)
-# set(CAPTURE_MODE "DPDK")
-#endif()
-#
-#if(OPT_IOMODE_PAG_N95)
-# set(CAPTURE_MODE "PAG_N95")
-#endif()
+set_property(CACHE CAPTURE_MODE PROPERTY STRINGS PCAP MARSIO PAG)
-if(OPT_IOMODE_MARSIO)
- set(CAPTURE_MODE "MARSIO")
- set(MARSIO_SDK_PREFIX "/opt/mrzcpd/" CACHE STRING "MARSIO Prefix")
-endif()
+message(STATUS "CAPTURE_MODE='${CAPTURE_MODE}'")
if(CAPTURE_MODE MATCHES "PCAP")
set(CAPTURE_DEFINITIONS -DONLY_PCAP -DIOMODE_PCAP)
@@ -91,41 +86,30 @@ if(CAPTURE_MODE MATCHES "PAG")
set(CAPTURE_DEFINITIONS -DCAPTURE_MODE_PAG)
endif()
-#if(CAPTURE_MODE MATCHES "PPF")
-# set(CAPTURE_DEFINITIONS -DCAPTURE_MODE_PPF)
-#endif()
-#
-#if(CAPTURE_MODE MATCHES "PFRING")
-# set(CAPTURE_DEFINITIONS -DCAPTURE_MODE_PFRING)
-#endif()
-#
-#if(CAPTURE_MODE MATCHES "DPDK")
-# set(CAPTURE_DEFINITIONS -DCAPTURE_MODE_DPDK)
-#endif()
if(CAPTURE_MODE MATCHES "MARSIO")
+ set(MARSIO_SDK_PREFIX "/opt/mrzcpd/" CACHE STRING "MARSIO Prefix")
set(CAPTURE_DEFINITIONS -DCAPTURE_MODE_MARSIO -DIOMODE_MARSIO)
endif()
# Memory Allocator
-option(OPT_USE_DICTATOR "Use Dictator2 memory allocator" OFF)
-option(OPT_USE_DICTATOR_DEBUG "Use Dictator2 memory allocator" OFF)
-option(OPT_USE_TCMALLOC "Use TCmalloc memory allocator" OFF)
-option(OPT_USE_TCMALLOC_MINI "Use TCmalloc memory allocator" OFF)
-option(OPT_USE_JEMALLOC "Use JEmalloc memory allocator" OFF)
+set(MEM_POOL "OFF" CACHE STRING
+ " set mem alloc chosen by the user, using off as default")
+set_property(CACHE MEM_POOL PROPERTY STRINGS OFF DICTATOR DICTATOR_DEBUG
+ TCMALLOC TCMALLOC_MINI JEMALLOC)
+message(STATUS "MEM_POOL='${MEM_POOL}'")
-if(OPT_USE_DICTATOR_DEBUG)
+if(MEM_POOL MATCHES "DICTATOR")
set(MEM_POOL_DEFINITIONS -DDICTATOR_DEBUG)
-endif()
-if(OPT_USE_DICTATOR OR OPT_USE_DICTATOR_DEBUG)
+elseif(MEM_POOL MATCHES "DICTATOR_DEBUG")
set(MEM_POOL_DEFINITIONS ${MEM_POOL_DEFINITIONS} -DUSE_MEM_POOL=1
-DUSE_MEMPOOL)
-elseif(OPT_USE_TCMALLOC_MINI)
+elseif(MEM_POOL MATCHES "TCMALLOC_MINI")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltcmalloc_minimal -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
-elseif(OPT_USE_TCMALLOC)
+elseif(MEM_POOL MATCHES "TCMALLOC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltcmalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
-elseif(OPT_USE_JEMALLOC)
+elseif(MEM_POOL MATCHES "JEMALLOC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
endif()
@@ -197,7 +181,7 @@ endif()
install(FILES run/plug/protocol/conflist_protocol.inf DESTINATION plug/protocol)
-if(NOT PLATFORM_MODE_SERIAL)
+if(PLATFORM_MODE MATCHES "MIRROR")
install(FILES run/plug/protocol/isakmp_protocol_plug/isakmp_protocol_plug.inf DESTINATION plug/protocol/isakmp_protocol_plug)
install(FILES ${CMAKE_BINARY_DIR}/inner_plug/isakmp_protocol_plug.so DESTINATION plug/protocol/isakmp_protocol_plug)
@@ -210,7 +194,7 @@ endif()
install(FILES run/plug/platform/conflist_platform.inf DESTINATION plug/platform)
-if(PLATFORM_MODE_SERIAL)
+if(PLATFORM_MODE MATCHES "INLINE")
install(FILES run/plug/platform/g_device_plug/g_device_plug.inf DESTINATION plug/platform/g_device_plug)
install(FILES ${CMAKE_BINARY_DIR}/inner_plug/g_device_plug.so DESTINATION plug/platform/g_device_plug)
endif()
@@ -223,4 +207,4 @@ install(FILES ${CMAKE_BINARY_DIR}/test_so/test_app_sapp.so DESTINATION plug/busi
install(FILES ${CMAKE_BINARY_DIR}/test_so/trace_delay.so DESTINATION plug/business/test_app)
-include(Package) \ No newline at end of file
+include(Package)
diff --git a/dealpkt/callapp.c b/dealpkt/callapp.c
index bd38662..42c1b13 100644
--- a/dealpkt/callapp.c
+++ b/dealpkt/callapp.c
@@ -437,6 +437,14 @@ int stream_process(struct streaminfo *a_stream,const void *this_iphdr, const voi
else
{
*opstate= OP_STATE_CLOSE;
+ if (a_stream->type == STREAM_TYPE_TCP)
+ {
+ g_SysInputInfo[threadnum][TCP_LINK_DISPOSABLE]++;
+ }
+ if (a_stream->type == STREAM_TYPE_UDP)
+ {
+ g_SysInputInfo[threadnum][UDP_LINK_DISPOSABLE]++;
+ }
}
return ret;
diff --git a/include/sysinfo.h b/include/sysinfo.h
index ddfa51c..6519390 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -128,6 +128,11 @@
#define PKT_MARSIO_MALLOC (102)
#define PKT_MARSIO_FREE (103)
+#define TCP_LINK_DISPOSABLE (100)
+#define UDP_LINK_DISPOSABLE (101)
+#define STREAM_DISPOSABLE (102)
+
+
//group info
#define PKT_APP_BASE 1000
diff --git a/inner_plug/sapp_assistant.cpp b/inner_plug/sapp_assistant.cpp
index 0e2d687..3042ab0 100644
--- a/inner_plug/sapp_assistant.cpp
+++ b/inner_plug/sapp_assistant.cpp
@@ -415,6 +415,7 @@ static int sapp_fs2_init(void)
int cfg_port;
int fs2_opt;
int cycle;
+ int send_historgram;
MESA_load_profile_int_def("conf/main.conf", "ShowStatInfo", "FS_switch", &module_switch, 0);
if(0 == module_switch){
@@ -455,6 +456,8 @@ static int sapp_fs2_init(void)
MESA_load_profile_int_def("conf/main.conf", "ShowStatInfo", "FS_print_switch", &fs2_opt, 0);
FS_set_para(sapp_global_single.fs2_handle, PRINT_TRIGGER, &fs2_opt, sizeof(int));
+ MESA_load_profile_int_def("conf/main.conf", "ShowStatInfo", "FS_send_histogram", &send_historgram, 0);
+
FS_set_para(sapp_global_single.fs2_handle, OUTPUT_DEVICE, "fs2_sysinfo.log", strlen("fs2_sysinfo.log")+1);
FS_set_para(sapp_global_single.fs2_handle, APP_NAME, "sapp", strlen("sapp")+1);
@@ -504,7 +507,10 @@ static int sapp_fs2_init(void)
1, //��׷�ٵ���Сֵ
100000000, //��׷�ٵ����ֵ
2); //���ȣ���С�����λ����Χ1~4
-
+ if (send_historgram == 0)
+ {
+ FS_set_para(sapp_global_single.fs2_handle, NOT_SEND_METRIC_TO_SERVER, &sapp_global_single.fs2_latency_id_array[i], sizeof(int));
+ }
}
FS_start(sapp_global_single.fs2_handle);
diff --git a/packet_io/packet_io_marsio.c b/packet_io/packet_io_marsio.c
index 6b29f74..9e00a19 100644
--- a/packet_io/packet_io_marsio.c
+++ b/packet_io/packet_io_marsio.c
@@ -674,7 +674,7 @@ static void *marsio4_worker(void *arg)
int dl_io_init(int argc, char *argv[])
{
- int i;
+ int i, ret;
char bind_mask_string[128];
char app_name[32];
@@ -684,30 +684,6 @@ int dl_io_init(int argc, char *argv[])
marsio4_burst_process_pkt_num = MARSIO_BURST_PKT_MAX - 1;
}
- /* TODO, ֧�ֲ�����MASK����, ��1,2,3,5,9; 0 means not bind */
- MESA_load_profile_string_def((char *)"conf/main.conf", (char *)"Module", (char *)"cpu_bind_core_mask", bind_mask_string, 128, "$");
- if(bind_mask_string[0] == '$'){
- marsio4_thread_bind_mask = 0;
- printf("\033[33m[Warning]In marsio mode, not set main.conf->cpu_bind_core_mask value, maybe cause CPU preemption!\033[0m\n");
- sleep(1);
- }else if(strncmp("0x", bind_mask_string, 2) == 0){
- marsio4_thread_bind_mask = strtoul(bind_mask_string, NULL, 16);
- if(calc_integer_bit_num(marsio4_thread_bind_mask) != g_marsio4_work_thread_num){
- printf("\033[41m[Error]main.conf->cpu_bind_core_mask value is not match main.conf->threadnum!\033[0m\n");
- printf("\033[41m main.conf->cpu_bind_core_mask bit numer must match main.conf->threadnum, \033[0m\n");
- printf("\033[41m for example, threadnum=8, core_mask shoule be 0xFF, 0xFF0, 0xFF00, etc.\033[0m\n");
- printf("\033[41m for example, threadnum=16, core_mask shoule be 0xFFFF, 0xFFFF0, 0xFFFF00, etc.\033[0m\n");
- return -1;
- }
- }else if(atoi(bind_mask_string) == 0){
- marsio4_thread_bind_mask = 0;
- printf("\033[33m[Warning]In marsio mode, main.conf->cpu_bind_core_mask value is 0, same as not set, maybe cause CPU preemption!\033[0m\n");
- sleep(1);
- }else{
- printf("\033[41m[Error]main.conf->cpu_bind_core_mask value incorrect!\033[0m\n");
- return -1;
- }
-
sapp_marsio4_instance = marsio_create();
if(NULL == sapp_marsio4_instance) {
fprintf(stderr,"%s\n","marsio_create error!\n");
@@ -729,8 +705,76 @@ int dl_io_init(int argc, char *argv[])
g_mario4_io_handle = (marsio4_io_handle *)calloc(1, sizeof(marsio4_io_handle) * g_marsio4_work_thread_num);
marsio_option_set(sapp_marsio4_instance, MARSIO_OPT_THREAD_NUM, &g_marsio4_work_thread_num, sizeof(int));
- if(marsio4_thread_bind_mask != 0){
- marsio_option_set(sapp_marsio4_instance, MARSIO_OPT_THREAD_MASK, &marsio4_thread_bind_mask, sizeof(long));
+
+ unsigned int cpu_mask_array[sizeof(cpu_set_t) * 8] = {0};
+ int cpu_mask_num = MESA_load_profile_uint_range((char *)"conf/main.conf", (char *)"Module", (char *)"cpu_bind_core", sizeof(cpu_set_t) * 8, cpu_mask_array);
+ if (cpu_mask_num > 0)
+ {
+ if (cpu_mask_num != g_marsio4_work_thread_num)
+ {
+ printf("\033[41m[Error]main.conf->cpu_bind_core_mask value is not match main.conf->threadnum!\033[0m\n");
+ printf("\033[41m main.conf->cpu_bind_core bit numer must match main.conf->threadnum, \033[0m\n");
+ printf("\033[41m for example, threadnum=8, bind_core shoule be 1-8 or 2-9 etc.\033[0m\n");
+ printf("\033[41m for example, threadnum=16, bind_core shoule be 1-16 or 2-17 etc.\033[0m\n");
+ return -1;
+ }
+ else
+ {
+ cpu_set_t cpu_mask;
+ CPU_ZERO(&cpu_mask);
+ for (i = 0; i < cpu_mask_num; i++)
+ {
+ CPU_SET(cpu_mask_array[i], &cpu_mask);
+ }
+ ret = marsio_option_set(sapp_marsio4_instance, MARSIO_OPT_THREAD_MASK_IN_CPUSET, &cpu_mask, sizeof(cpu_mask));
+ if (ret < 0)
+ {
+ MESA_load_profile_string_nodef((char *)"conf/main.conf", (char *)"Module", (char *)"cpu_bind_core", bind_mask_string, sizeof(bind_mask_string));
+ printf("\033[1;31;40m[Error] marsio set CPU-MASK '%s' failed!\033[0m\n", bind_mask_string);
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ ret = MESA_load_profile_string_def((char *)"conf/main.conf", (char *)"Module", (char *)"cpu_bind_core_mask", bind_mask_string, 128, "$");
+ if (bind_mask_string[0] == '$')
+ {
+ marsio4_thread_bind_mask = 0;
+ printf("\033[33m[Warning]In marsio mode, not set main.conf->cpu_bind_core_mask value, maybe cause CPU preemption!\033[0m\n");
+ sleep(1);
+ }
+ else if (strncmp("0x", bind_mask_string, 2) == 0)
+ {
+ marsio4_thread_bind_mask = strtoul(bind_mask_string, NULL, 16);
+ if (calc_integer_bit_num(marsio4_thread_bind_mask) != g_marsio4_work_thread_num)
+ {
+ printf("\033[41m[Error]main.conf->cpu_bind_core_mask value is not match main.conf->threadnum!\033[0m\n");
+ printf("\033[41m main.conf->cpu_bind_core_mask bit numer must match main.conf->threadnum, \033[0m\n");
+ printf("\033[41m for example, threadnum=8, core_mask shoule be 0xFF, 0xFF0, 0xFF00, etc.\033[0m\n");
+ printf("\033[41m for example, threadnum=16, core_mask shoule be 0xFFFF, 0xFFFF0, 0xFFFF00, etc.\033[0m\n");
+ return -1;
+ }
+ }
+ else if (atoi(bind_mask_string) == 0)
+ {
+ marsio4_thread_bind_mask = 0;
+ printf("\033[33m[Warning]In marsio mode, main.conf->cpu_bind_core_mask value is 0, same as not set, maybe cause CPU preemption!\033[0m\n");
+ sleep(1);
+ }
+ else
+ {
+ printf("\033[41m[Error]main.conf->cpu_bind_core_mask value incorrect!\033[0m\n");
+ return -1;
+ }
+ if (marsio4_thread_bind_mask != 0)
+ {
+ ret = marsio_option_set(sapp_marsio4_instance, MARSIO_OPT_THREAD_MASK, &marsio4_thread_bind_mask, sizeof(long));
+ if (ret < 0)
+ {
+ printf("\033[1;31;40m[Error] marsio set CPU-MASK '%lx' failed!\033[0m\n", marsio4_thread_bind_mask);
+ }
+ }
}
MESA_load_profile_string_def((char *)"conf/main.conf", (char *)"Module", (char *)"app_instance_name", app_name, 32, "sapp");
diff --git a/packet_io/packet_io_status.cpp b/packet_io/packet_io_status.cpp
index 98f0cf3..695c96d 100644
--- a/packet_io/packet_io_status.cpp
+++ b/packet_io/packet_io_status.cpp
@@ -236,21 +236,30 @@ void sysinfo_output(void)
fprintf(fp,"#################################################################\n");
- fprintf(fp,"%-10s %12s %12s\n","TCP_LINK", "total_link", "link/s");
- fprintf(fp,"%-10s %12llu %12llu\n", "TCP_NEW", sysinfo_new[SYS_TCP_LINK_NEW],
- sysinfo_new[SYS_TCP_LINK_NEW] - sysinfo_old[SYS_TCP_LINK_NEW]);
- //fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DATA", sysinfo_new[SYS_TCP_LINK_DATA],
- // sysinfo_new[SYS_TCP_LINK_DATA] - sysinfo_old[SYS_TCP_LINK_DATA]);
- fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DEL", sysinfo_new[SYS_TCP_LINK_DEL],
- sysinfo_new[SYS_TCP_LINK_DEL] - sysinfo_old[SYS_TCP_LINK_DEL]);
- fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DOU", sysinfo_new[LINK_DOUBLE],
- sysinfo_new[LINK_DOUBLE] - sysinfo_old[LINK_DOUBLE]);
- fprintf(fp,"%-10s %12llu %12llu\n", "TCP_C2S", sysinfo_new[LINK_SINGLE_C2S],
- sysinfo_new[LINK_SINGLE_C2S] - sysinfo_old[LINK_SINGLE_C2S]);
- 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\n", "TCP_LINK", "total_link", "link/s");
+ fprintf(fp, "%-10s %12llu %12llu\n", "TCP_NEW", sysinfo_new[SYS_TCP_LINK_NEW],
+ sysinfo_new[SYS_TCP_LINK_NEW] - sysinfo_old[SYS_TCP_LINK_NEW]);
+ fprintf(fp, "%-10s %12llu %12llu\n", "TCP_DIS", sysinfo_new[TCP_LINK_DISPOSABLE],
+ sysinfo_new[TCP_LINK_DISPOSABLE] - sysinfo_old[TCP_LINK_DISPOSABLE]);
+ //fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DATA", sysinfo_new[SYS_TCP_LINK_DATA],
+ // sysinfo_new[SYS_TCP_LINK_DATA] - sysinfo_old[SYS_TCP_LINK_DATA]);
+ fprintf(fp, "%-10s %12llu %12llu\n", "TCP_DEL", sysinfo_new[SYS_TCP_LINK_DEL],
+ sysinfo_new[SYS_TCP_LINK_DEL] - sysinfo_old[SYS_TCP_LINK_DEL]);
+ fprintf(fp, "%-10s %12llu %12llu\n", "TCP_DOU", sysinfo_new[LINK_DOUBLE],
+ sysinfo_new[LINK_DOUBLE] - sysinfo_old[LINK_DOUBLE]);
+ fprintf(fp, "%-10s %12llu %12llu\n", "TCP_C2S", sysinfo_new[LINK_SINGLE_C2S],
+ sysinfo_new[LINK_SINGLE_C2S] - sysinfo_old[LINK_SINGLE_C2S]);
+ 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\n", "UDP_LINK", "total_link", "link/s");
+ fprintf(fp, "%-10s %12llu %12llu\n", "UDP_NEW", sysinfo_new[SYS_UDP_LINK_NEW],
+ sysinfo_new[SYS_UDP_LINK_NEW] - sysinfo_old[SYS_UDP_LINK_NEW]);
+ fprintf(fp, "%-10s %12llu %12llu\n", "UDP_DIS", sysinfo_new[UDP_LINK_DISPOSABLE],
+ sysinfo_new[UDP_LINK_DISPOSABLE] - sysinfo_old[UDP_LINK_DISPOSABLE]);
+
+ 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));