diff --git a/CMakeLists.txt b/CMakeLists.txt index b15b5c7e0d..1ac0014168 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ if(ENABLE_GPERF AND USE_JEMALLOC) endif() if(USE_JEMALLOC) + message(STATUS "jemalloc is enabled") set(JEMALLOC_LIB_TYPE "SHARED") endif() diff --git a/run.sh b/run.sh index 821a3556da..c99cf43c7e 100755 --- a/run.sh +++ b/run.sh @@ -307,8 +307,9 @@ function run_build() cd $ROOT/src C_COMPILER="$C_COMPILER" CXX_COMPILER="$CXX_COMPILER" BUILD_TYPE="$BUILD_TYPE" \ CLEAR="$CLEAR" PART_CLEAR="$PART_CLEAR" JOB_NUM="$JOB_NUM" \ - WARNING_ALL="$WARNING_ALL" ENABLE_GCOV="$ENABLE_GCOV" SANITIZER="$SANITIZER"\ - RUN_VERBOSE="$RUN_VERBOSE" TEST_MODULE="$TEST_MODULE" DISABLE_GPERF="$DISABLE_GPERF" ./build.sh + WARNING_ALL="$WARNING_ALL" ENABLE_GCOV="$ENABLE_GCOV" SANITIZER="$SANITIZER" \ + RUN_VERBOSE="$RUN_VERBOSE" TEST_MODULE="$TEST_MODULE" \ + DISABLE_GPERF="$DISABLE_GPERF" USE_JEMALLOC="$USE_JEMALLOC" ./build.sh if [ $? -ne 0 ]; then echo "ERROR: build pegasus failed" exit 1 diff --git a/scripts/pack_client.sh b/scripts/pack_client.sh index 2d7c9ebeca..bf9ce8e12e 100755 --- a/scripts/pack_client.sh +++ b/scripts/pack_client.sh @@ -93,6 +93,12 @@ while [[ $# > 0 ]]; do -h|--help) usage ;; + *) + echo "ERROR: unknown option \"$option_key\"" + echo + usage + exit 1 + ;; esac shift done diff --git a/scripts/pack_server.sh b/scripts/pack_server.sh index 206fb5a9dd..e4fd37c082 100755 --- a/scripts/pack_server.sh +++ b/scripts/pack_server.sh @@ -24,6 +24,7 @@ function usage() { echo " -p|--update-package-template " echo " -g|--custom-gcc" echo " -k|--keytab-file" + echo " -j|--use-jemalloc" exit 0 } @@ -74,6 +75,7 @@ fi custom_gcc="false" keytab_file="" +use_jemalloc="off" while [[ $# > 0 ]]; do option_key="$1" @@ -92,6 +94,15 @@ while [[ $# > 0 ]]; do keytab_file="$2" shift ;; + -j | --use-jemalloc) + use_jemalloc="on" + ;; + *) + echo "ERROR: unknown option \"$option_key\"" + echo + usage + exit 1 + ;; esac shift done @@ -102,7 +113,14 @@ copy_file ./DSN_ROOT/lib/libdsn_meta_server.so ${pack}/bin copy_file ./DSN_ROOT/lib/libdsn_replica_server.so ${pack}/bin copy_file ./DSN_ROOT/lib/libdsn_utils.so ${pack}/bin copy_file ./thirdparty/output/lib/libPoco*.so.* ${pack}/bin -copy_file ./thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/bin + +if [ "$use_jemalloc" == "on" ]; then + copy_file ./thirdparty/output/lib/libjemalloc.so.2 ${pack}/bin + copy_file ./thirdparty/output/lib/libprofiler.so.0 ${pack}/bin +else + copy_file ./thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/bin +fi + copy_file ./thirdparty/output/lib/libboost*.so.1.69.0 ${pack}/bin copy_file ./thirdparty/output/lib/libhdfs* ${pack}/bin copy_file ./thirdparty/output/lib/libsasl*.so.* ${pack}/bin diff --git a/scripts/pack_tools.sh b/scripts/pack_tools.sh index 699e73c9f8..7d7f4384c3 100755 --- a/scripts/pack_tools.sh +++ b/scripts/pack_tools.sh @@ -24,6 +24,7 @@ function usage() echo " -h" echo " -p|--update-package-template " echo " -g|--custom-gcc" + echo " -j|--use-jemalloc" exit 0 } @@ -79,6 +80,7 @@ if [ -n "$MINOS_CONFIG_FILE" ]; then fi custom_gcc="false" +use_jemalloc="off" while [[ $# > 0 ]]; do option_key="$1" @@ -93,6 +95,15 @@ while [[ $# > 0 ]]; do -h|--help) usage ;; + -j|--use-jemalloc) + use_jemalloc="on" + ;; + *) + echo "ERROR: unknown option \"$option_key\"" + echo + usage + exit 1 + ;; esac shift done @@ -111,7 +122,14 @@ cp -v -r ./DSN_ROOT/bin/pegasus_pressureclient ${pack}/DSN_ROOT/bin/ mkdir -p ${pack}/DSN_ROOT/lib copy_file ./DSN_ROOT/lib/*.so* ${pack}/DSN_ROOT/lib/ copy_file ./thirdparty/output/lib/libPoco*.so.* ${pack}/DSN_ROOT/lib/ -copy_file ./thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/DSN_ROOT/lib/ + +if [ "$use_jemalloc" == "on" ]; then + copy_file ./thirdparty/output/lib/libjemalloc.so.2 ${pack}/DSN_ROOT/lib/ + copy_file ./thirdparty/output/lib/libprofiler.so.0 ${pack}/DSN_ROOT/lib/ +else + copy_file ./thirdparty/output/lib/libtcmalloc_and_profiler.so.4 ${pack}/DSN_ROOT/lib/ +fi + copy_file ./thirdparty/output/lib/libboost*.so.1.69.0 ${pack}/DSN_ROOT/lib/ copy_file ./thirdparty/output/lib/libhdfs* ${pack}/DSN_ROOT/lib copy_file `get_stdcpp_lib $custom_gcc` ${pack}/DSN_ROOT/lib/ diff --git a/src/build.sh b/src/build.sh index aa6965eddb..8cfbd0acef 100755 --- a/src/build.sh +++ b/src/build.sh @@ -111,6 +111,14 @@ else echo "DISABLE_GPERF=NO" fi +if [ "$USE_JEMALLOC" == "ON" ] +then + echo "USE_JEMALLOC=ON" + CMAKE_OPTIONS="$CMAKE_OPTIONS -DUSE_JEMALLOC=ON" +else + echo "USE_JEMALLOC=OFF" +fi + CMAKE_OPTIONS="$CMAKE_OPTIONS -DBoost_NO_BOOST_CMAKE=ON -DBOOST_ROOT=${ROOT}/thirdparty/output -DBoost_NO_SYSTEM_PATHS=ON" echo "#############################################################################" diff --git a/src/rdsn/scripts/linux/build.sh b/src/rdsn/scripts/linux/build.sh index 11ca016c2b..6438b75900 100755 --- a/src/rdsn/scripts/linux/build.sh +++ b/src/rdsn/scripts/linux/build.sh @@ -105,10 +105,10 @@ fi if [ "$USE_JEMALLOC" == "ON" ] then - echo "USE_JEMALLOC=YES" + echo "USE_JEMALLOC=ON" CMAKE_OPTIONS="$CMAKE_OPTIONS -DUSE_JEMALLOC=ON" else - echo "USE_JEMALLOC=NO" + echo "USE_JEMALLOC=OFF" fi if [ ! -z "$SANITIZER" ]