diff options
| author | yangwei <[email protected]> | 2019-07-24 18:30:46 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2019-07-24 18:30:46 +0800 |
| commit | 0972a436cadf55c89eef9f6924b7216e9f9c1492 (patch) | |
| tree | 3b2a2e2bbe57cb7c3405ece91daef60a65979fa4 | |
| parent | 423ef10bfc53891b81aee7f65156313538299045 (diff) | |
1、更新CMakelist,使用下拉菜单选择相同类型的编译选项
2、修复注册fs2中latency时,对NOT_SEND_METRIC_TO_SERVER错误的设置
3、更新gitignore,增加vscode工程文件目录
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | CMakeLists.txt | 114 | ||||
| -rw-r--r-- | entry/CMakeLists.txt | 28 | ||||
| -rw-r--r-- | inner_plug/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | inner_plug/sapp_assistant.cpp | 3 |
5 files changed, 58 insertions, 90 deletions
@@ -12,3 +12,4 @@ run/log/ run/sapp version.txt cmake-build-debug +.vscode/*
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 903c6bb..334d5ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,30 +18,39 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Werror -DHIGH_PERF=1") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -DHIGH_PERF=0") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DHIGH_PERF=0") -#set(CMAKE_INSTALL_PREFIX /home/ceiec/sapp/) set(CMAKE_INSTALL_PREFIX /home/mesasoft/sapp_run/) -option(PLATFORM_MODE_SERIAL "Using serial mode" FALSE) +set(PLATFORM_MODE "MIRROR" 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) +option(STATIC_LINK "Enable static link" TRUE) # CPU profiler -option(OPT_USE_PROFILER "Use gperf cpu profiler" OFF) -if(OPT_USE_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") @@ -51,42 +60,15 @@ 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" OFF) - -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() +set_property(CACHE CAPTURE_MODE PROPERTY STRINGS PCAP PAG MARSIO) + +message(STATUS "CAPTURE_MODE='${CAPTURE_MODE}'") -#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() - -if(OPT_IOMODE_MARSIO) - set(CAPTURE_MODE "MARSIO") -endif() if(CAPTURE_MODE MATCHES "PCAP") set(CAPTURE_DEFINITIONS -DONLY_PCAP -DIOMODE_PCAP) @@ -96,46 +78,34 @@ 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(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() add_definitions(${CAPTURE_DEFINITIONS} ${MEM_POOL_DEFINITIONS} -D__FAVOR_BSD=1 - -D__USE_BSD=1 -D_GNU_SOURCE=1 -DMESA_SAPP_PLATFORM=1) + -D__USE_BS=1 -D_GNU_SOURCE=1 -DMESA_SAPP_PLATFORM=1) set(SAPP_DEPEND_DYN_LIB MESA_handle_logger MESA_htable pthread MESA_field_stat2) @@ -199,13 +169,13 @@ if(CAPTURE_MODE MATCHES "PAG") install(FILES ${CMAKE_BINARY_DIR}/packet_io/packet_io_pag.so DESTINATION platform_lib) endif() -#if(CAPTURE_MODE MATCHES "PCAP") +if(CAPTURE_MODE MATCHES "PCAP") install(FILES ${CMAKE_BINARY_DIR}/packet_io/packet_io_pcap.so DESTINATION platform_lib) -#endif() +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) @@ -218,7 +188,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() @@ -231,4 +201,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/entry/CMakeLists.txt b/entry/CMakeLists.txt index 07555ae..43ad0fd 100644 --- a/entry/CMakeLists.txt +++ b/entry/CMakeLists.txt @@ -28,21 +28,21 @@ set(SAPP_MODULES iknow timestamp_record md5 symbol_check MESA_sleep MESA_socket_ target_link_libraries(sapp -Wl,--whole-archive ${SAPP_MODULES} -Wl,--no-whole-archive ${SAPP_DEPEND_DYN_LIB}) -if(CAPTURE_MODE MATCHES "PAG") - target_link_libraries(sapp pag) -endif() - -if(CAPTURE_MODE MATCHES "PPF") - target_link_libraries(psapp ppf) -endif() - -if(CAPTURE_MODE MATCHES "PFRING") - target_link_libraries(sapp pfring) -endif() +#if(CAPTURE_MODE MATCHES "PAG") +# target_link_libraries(sapp pag) +#endif() -if(CAPTURE_MODE MATCHES "DPDK") - target_link_libraries(sapp nl2fwd) -endif() +#if(CAPTURE_MODE MATCHES "PPF") +# target_link_libraries(psapp ppf) +#endif() +# +#if(CAPTURE_MODE MATCHES "PFRING") +# target_link_libraries(sapp pfring) +#endif() +# +#if(CAPTURE_MODE MATCHES "DPDK") +# target_link_libraries(sapp nl2fwd) +#endif() # Target Install #install(TARGETS sapp DESTINATION ${CMAKE_SOURCE_DIR}/run/) diff --git a/inner_plug/CMakeLists.txt b/inner_plug/CMakeLists.txt index 44ca655..94cc36a 100644 --- a/inner_plug/CMakeLists.txt +++ b/inner_plug/CMakeLists.txt @@ -28,7 +28,7 @@ set_target_properties(isakmp_protocol_plug PROPERTIES PREFIX "") add_library(g_device_plug SHARED g_device_plug.c) set_target_properties(g_device_plug PROPERTIES PREFIX "") -if(ENABLE_STATIC_LINK) +if(STATIC_LINK) add_library(sapp_assistant STATIC sapp_assistant.cpp) add_library(gdev_assistant STATIC gdev_assistant.c) else() diff --git a/inner_plug/sapp_assistant.cpp b/inner_plug/sapp_assistant.cpp index 51946c9..7f1d0ac 100644 --- a/inner_plug/sapp_assistant.cpp +++ b/inner_plug/sapp_assistant.cpp @@ -328,9 +328,6 @@ static int sapp_fs2_init(void) MESA_load_profile_int_def("conf/main.conf", "ShowStatInfo", "FS_send_histogram", &send_historgram, 0); - FS_set_para(sapp_global_single.fs2_handle, NOT_SEND_METRIC_TO_SERVER, &send_historgram, sizeof(int)); - - 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, fs_name, strlen(fs_name)+1); |
