summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘学利 <[email protected]>2022-09-20 05:19:51 +0000
committer刘学利 <[email protected]>2022-09-20 05:19:51 +0000
commit8c77537c819ac4d99fbe92d546047251cc891b7e (patch)
treeced12d72beb6b27bc7a696e7843575ddd3b7654a
parentf36ee772f63a0bfa0f33a73ce8d8b1060e620e90 (diff)
使用jemalloc作为默认内存池,静态链接jemalloc,使用jemalloc-v5.3.0版本v4.2.90
-rw-r--r--.gitlab-ci.yml28
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/entry/CMakeLists.txt2
-rw-r--r--vendor/CMakeLists.txt17
-rw-r--r--vendor/jemalloc-5.3.0.tar.gzbin0 -> 799843 bytes
5 files changed, 36 insertions, 15 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 13798c3..ec967d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,11 @@ variables:
BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
BUILD_IMAGE_CENTOS7: "git.mesalab.cn:7443/mesa_platform/build-env:master"
BUILD_IMAGE_CENTOS8: "git.mesalab.cn:7443/mesa_platform/build-env:rockylinux"
- INSTALL_DEPENDENCY_LIBRARY: libunwind gperftools mrzcpd numactl-devel zlib-devel librdkafka-devel systemd-devel libMESA_htable-devel libMESA_prof_load-devel libcjson-devel libMESA_field_stat2-devel framework_env libwiredcfg-devel libWiredLB-devel libMESA_handle_logger-devel libbreakpad_mini-devel vim-common libMESA_jump_layer-devel libMESA_jump_layer sapp_benchmark sapp_benchmark-devel
+ INSTALL_DEPENDENCY_LIBRARY:
+ libunwind gperftools numactl-devel zlib-devel librdkafka-devel systemd-devel jemalloc jemalloc-devel vim-common
+ libMESA_htable-devel libMESA_prof_load-devel libcjson-devel libMESA_field_stat2-devel framework_env
+ libwiredcfg-devel libWiredLB-devel libMESA_handle_logger-devel libbreakpad_mini-devel mrzcpd
+ libMESA_jump_layer-devel libMESA_jump_layer
SYMBOL_TARGET: sapp
INSTALL_PREFIX: "/home/mesasoft/sapp_run/"
@@ -57,7 +61,7 @@ stages:
- yum makecache
- yum install -y net-tools psmisc iproute initscripts gperftools-libs gdb snappy
- yum install -y libMESA_htable libMESA_prof_load libMESA_field_stat2 libMESA_handle_logger libcjson systemd systemd-devel libpcap libpcap-devel libbreakpad_mini libMESA_jump_layer
- - yum install -y sapp benchmark_pcap gtest-devel zlib-devel
+ - yum install -y sapp benchmark_pcap gtest-devel zlib-devel jemalloc
- yum install -y framework_env; source /etc/profile.d/framework.sh
- ls -l /opt/MESA/lib
- echo "/opt/MESA/lib" >> /etc/ld.so.conf
@@ -145,7 +149,7 @@ branch_build_debug_for_centos7:
BUILD_TYPE: Debug
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
artifacts:
paths:
- build/*
@@ -161,7 +165,7 @@ branch_build_release_for_centos7:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
extends: .build_by_travis_for_centos7
artifacts:
paths:
@@ -179,7 +183,7 @@ develop_build_debug_for_centos7:
BUILD_TYPE: Debug
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
ASAN_OPTION: "OFF"
@@ -202,7 +206,7 @@ develop_build_release_for_centos7:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
ASAN_OPTION: "OFF"
@@ -224,7 +228,7 @@ release_build_release_for_centos7:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
PULP3_REPO_NAME: platform-stable-x86_64.el7
@@ -244,7 +248,7 @@ branch_build_debug_for_centos8:
BUILD_TYPE: Debug
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
artifacts:
paths:
- build/*
@@ -260,7 +264,7 @@ branch_build_release_for_centos8:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
extends: .build_by_travis_for_centos8
artifacts:
paths:
@@ -278,7 +282,7 @@ develop_build_debug_for_centos8:
BUILD_TYPE: Debug
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
ASAN_OPTION: "OFF"
@@ -301,7 +305,7 @@ develop_build_release_for_centos8:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
ASAN_OPTION: "OFF"
@@ -323,7 +327,7 @@ release_build_release_for_centos8:
BUILD_TYPE: RelWithDebInfo
CAPTURE_MODE: MARSIO
PLATFORM_MODE: INLINE
- MEM_POOL: DICTATOR
+ MEM_POOL: JEMALLOC
PACKAGE: 1
UPLOAD: 1
PULP3_REPO_NAME: platform-stable-x86_64.el8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2eb334..975e6cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,7 +126,7 @@ if(CAPTURE_MODE MATCHES "TUN")
endif()
# Memory Allocator
-set(MEM_POOL "DICTATOR" CACHE STRING
+set(MEM_POOL "JEMALLOC" CACHE STRING
" set mem alloc chosen by the user, using DICTATOR as default")
set_property(CACHE MEM_POOL PROPERTY STRINGS OFF DICTATOR DICTATOR_DEBUG
TCMALLOC TCMALLOC_MINI JEMALLOC)
@@ -141,7 +141,7 @@ elseif(MEM_POOL MATCHES "TCMALLOC_MINI")
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(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")
+ #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
endif()
diff --git a/src/entry/CMakeLists.txt b/src/entry/CMakeLists.txt
index 1eada31..e82691b 100644
--- a/src/entry/CMakeLists.txt
+++ b/src/entry/CMakeLists.txt
@@ -25,7 +25,7 @@ target_link_libraries(sapp breakpad_mini)
target_include_directories(sapp PRIVATE ${SYSTEMD_INCLUDE_DIRS})
-set(SAPP_MODULES timestamp_record md5 symbol_check MESA_sleep MESA_socket_wrap packet_io dealpkt project plugctrl common config timer tomlc99_wrap dpdk_ip_hash libevent-static gdev_assistant inner_plug libdabloom-static sapp_dev sapp_assistant cpu_limit timeout)
+set(SAPP_MODULES timestamp_record md5 symbol_check MESA_sleep MESA_socket_wrap packet_io dealpkt project plugctrl common config timer tomlc99_wrap dpdk_ip_hash libevent-static gdev_assistant inner_plug libdabloom-static sapp_dev sapp_assistant cpu_limit timeout libjemalloc-static)
if(MEM_POOL MATCHES "DICTATOR_DEBUG")
set(SAPP_MODULES ${SAPP_MODULES} dictator2_debug)
diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt
index a0668a5..c03aaf2 100644
--- a/vendor/CMakeLists.txt
+++ b/vendor/CMakeLists.txt
@@ -48,3 +48,20 @@ add_dependencies(libdabloom-static libdabloom)
set_property(TARGET libdabloom-static PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib/libdablooms.a)
set_property(TARGET libdabloom-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
+## jemalloc
+ExternalProject_Add(libjemalloc PREFIX libjemalloc
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc-5.3.0.tar.gz
+ URL_MD5 594dd8e0a1e8c1ef8a1b210a1a5aff5b
+ CONFIGURE_COMMAND ./autogen.sh --prefix=<INSTALL_DIR>
+ BUILD_COMMAND make
+ BUILD_IN_SOURCE 1
+ INSTALL_COMMAND make install prefix=<INSTALL_DIR>)
+
+ExternalProject_Get_Property(libjemalloc INSTALL_DIR)
+file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
+
+add_library(libjemalloc-static STATIC IMPORTED GLOBAL)
+add_dependencies(libjemalloc-static libjemalloc)
+set_property(TARGET libjemalloc-static PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib/libjemalloc.a)
+set_property(TARGET libjemalloc-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
+
diff --git a/vendor/jemalloc-5.3.0.tar.gz b/vendor/jemalloc-5.3.0.tar.gz
new file mode 100644
index 0000000..ac67955
--- /dev/null
+++ b/vendor/jemalloc-5.3.0.tar.gz
Binary files differ