Merge pull request #1398 from yandex/revert-1381-fix2

Revert "Make gperftools (libtcmalloc) as submodule and update."
This commit is contained in:
alexey-milovidov 2017-10-24 22:18:28 +03:00 committed by GitHub
commit 996b18c816
12 changed files with 35 additions and 71 deletions

3
.gitmodules vendored
View File

@ -10,9 +10,6 @@
[submodule "contrib/lz4"] [submodule "contrib/lz4"]
path = contrib/lz4 path = contrib/lz4
url = https://github.com/lz4/lz4.git url = https://github.com/lz4/lz4.git
[submodule "contrib/gperftools"]
path = contrib/gperftools
url = https://github.com/gperftools/gperftools
[submodule "contrib/librdkafka"] [submodule "contrib/librdkafka"]
path = contrib/librdkafka path = contrib/librdkafka
url = https://github.com/edenhill/librdkafka.git url = https://github.com/edenhill/librdkafka.git

View File

@ -239,7 +239,7 @@ find_contrib_lib(btrie)
find_contrib_lib(double-conversion) find_contrib_lib(double-conversion)
# Need to process before "contrib" dir: # Need to process before "contrib" dir:
include (cmake/find_gperftools.cmake) include (libs/libcommon/cmake/find_gperftools.cmake)
include (libs/libcommon/cmake/find_jemalloc.cmake) include (libs/libcommon/cmake/find_jemalloc.cmake)
include (libs/libcommon/cmake/find_cctz.cmake) include (libs/libcommon/cmake/find_cctz.cmake)
include (libs/libmysqlxx/cmake/find_mysqlclient.cmake) include (libs/libmysqlxx/cmake/find_mysqlclient.cmake)

View File

@ -1,37 +0,0 @@
if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32)
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" OFF)
else ()
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ${NOT_UNBUNDLED})
endif ()
option (ENABLE_LIBTCMALLOC "Set to TRUE to enable libtcmalloc" ON)
option (DEBUG_LIBTCMALLOC "Set to TRUE to use debug version of libtcmalloc" OFF)
if (ENABLE_LIBTCMALLOC)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/gperftools/src/tcmalloc.h")
message (WARNING "submodule contrib/gperftools is missing. to fix try run: \n git submodule update --init --recursive")
set (USE_INTERNAL_GPERFTOOLS_LIBRARY 0)
set (MISSING_INTERNAL_GPERFTOOLS_LIBRARY 1)
endif ()
if (NOT USE_INTERNAL_GPERFTOOLS_LIBRARY)
find_package (Gperftools)
endif ()
if (NOT MISSING_INTERNAL_GPERFTOOLS_LIBRARY AND NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL) AND NOT (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32))
set (USE_INTERNAL_GPERFTOOLS_LIBRARY 1)
set (GPERFTOOLS_INCLUDE_DIR "${ClickHouse_BINARY_DIR}/contrib/gperftools/include")
endif ()
if (GPERFTOOLS_FOUND OR USE_INTERNAL_GPERFTOOLS_LIBRARY)
set (USE_TCMALLOC 1)
endif ()
message (STATUS "Using tcmalloc=${USE_TCMALLOC}: ${GPERFTOOLS_INCLUDE_DIR} : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
endif ()
macro (target_include_gperftools target)
if (USE_TCMALLOC)
add_dependencies (${target} gperftools)
target_include_directories (${target} BEFORE PRIVATE ${GPERFTOOLS_INCLUDE_DIR})
endif ()
endmacro ()

View File

@ -53,7 +53,7 @@ if (USE_INTERNAL_CCTZ_LIBRARY)
endif () endif ()
if (ENABLE_LIBTCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY) if (ENABLE_LIBTCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY)
add_subdirectory (gperftools-cmake) add_subdirectory (libtcmalloc)
endif () endif ()
if (NOT ARCH_ARM) if (NOT ARCH_ARM)

1
contrib/gperftools vendored

@ -1 +0,0 @@
Subproject commit 235471f96564aa95354839bb135661e561966001

View File

@ -1,17 +0,0 @@
set(GPERFTOOLS_ROOT ${ClickHouse_SOURCE_DIR}/contrib/gperftools)
set(GPERFTOOLS_BUILD ${ClickHouse_BINARY_DIR}/contrib/gperftools)
set(CC_FULL "${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}")
set(CXX_FULL "${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}")
get_property(C_LAUNCH GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
include(ExternalProject)
ExternalProject_Add(
gperftools
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND autoreconf -i ${GPERFTOOLS_ROOT} && env "CC=${C_LAUNCH} ${CMAKE_C_COMPILER}" "CXX=${C_LAUNCH} ${CMAKE_CXX_COMPILER}" CFLAGS=${FULL_C_FLAGS} CXXFLAGS=${FULL_CXX_FLAGS} ${GPERFTOOLS_ROOT}/configure --enable-minimal --with-pic --enable-shared=no --prefix=${GPERFTOOLS_BUILD}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j `nproc || sysctl -n hw.ncpu || echo 4`
)
set (GPERFTOOLS_TCMALLOC_MINIMAL ${ClickHouse_BINARY_DIR}/contrib/gperftools/lib/libtcmalloc_minimal.a CACHE INTERNAL "")
set (GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG ${ClickHouse_BINARY_DIR}/contrib/gperftools/lib/libtcmalloc_minimal_debug.a CACHE INTERNAL "")

View File

@ -191,7 +191,6 @@ target_link_libraries (dbms
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
) )
target_include_gperftools (dbms)
target_include_directories (dbms BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR}) target_include_directories (dbms BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})
target_include_directories (dbms BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) target_include_directories (dbms BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})

View File

@ -67,7 +67,7 @@ TEST(Common, RWLockFIFO_1)
Stopwatch watch(CLOCK_MONOTONIC_COARSE); Stopwatch watch(CLOCK_MONOTONIC_COARSE);
std::list<std::thread> threads; std::list<std::thread> threads;
for (size_t thread = 0; thread < pool_size; ++thread) for (int thread = 0; thread < pool_size; ++thread)
threads.emplace_back([=] () { func(pool_size, round); }); threads.emplace_back([=] () { func(pool_size, round); });
for (auto & thread : threads) for (auto & thread : threads)
@ -139,7 +139,7 @@ TEST(Common, RWLockFIFO_PerfTest_Readers)
}; };
std::list<std::thread> threads; std::list<std::thread> threads;
for (size_t thread = 0; thread < pool_size; ++thread) for (int thread = 0; thread < pool_size; ++thread)
threads.emplace_back(func); threads.emplace_back(func);
for (auto & thread : threads) for (auto & thread : threads)

View File

@ -38,7 +38,7 @@ int main(int argc, char ** argv)
{ {
size_t n = argc > 1 ? atoi(argv[1]) : 10; size_t n = argc > 1 ? atoi(argv[1]) : 10;
bool nested = false, sum = false, composite = false, multivalue = false; bool nested = false, sum = false, composite = false, multivalue = false;
for (int i = 2; i < argc; ++i) for (size_t i = 2; i < argc; ++i)
{ {
if (strcmp(argv[i], "nested") == 0) if (strcmp(argv[i], "nested") == 0)
nested = true; nested = true;

View File

@ -16,7 +16,7 @@ add_library(clickhouse-server
TCPHandler.cpp TCPHandler.cpp
) )
target_link_libraries (clickhouse-server daemon clickhouse_storages_system clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) target_link_libraries(clickhouse-server daemon clickhouse_storages_system clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions)
target_include_directories (clickhouse-server PUBLIC ${ClickHouse_SOURCE_DIR}/libs/libdaemon/include) target_include_directories (clickhouse-server PUBLIC ${ClickHouse_SOURCE_DIR}/libs/libdaemon/include)
add_library(clickhouse-local LocalServer.cpp) add_library(clickhouse-local LocalServer.cpp)
@ -40,11 +40,9 @@ target_include_directories (clickhouse-performance-test PRIVATE ${PCG_RANDOM_INC
add_library (clickhouse-compressor-lib Compressor.cpp) add_library (clickhouse-compressor-lib Compressor.cpp)
target_link_libraries (clickhouse-compressor-lib dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_link_libraries (clickhouse-compressor-lib dbms ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable (clickhouse main.cpp) add_executable(clickhouse main.cpp)
target_include_directories (clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR}) target_include_directories(clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
target_include_gperftools (clickhouse) target_link_libraries(clickhouse
target_link_libraries (clickhouse
clickhouse-server clickhouse-server
clickhouse-client clickhouse-client
clickhouse-local clickhouse-local

View File

@ -71,7 +71,6 @@ elseif (USE_TCMALLOC)
message (STATUS "Link libtcmalloc_minimal : ${GPERFTOOLS_TCMALLOC_MINIMAL}") message (STATUS "Link libtcmalloc_minimal : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL}) set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL})
endif () endif ()
target_include_gperftools (common)
else () else ()
message (STATUS "Disabling libtcmalloc for valgrind better analysis") message (STATUS "Disabling libtcmalloc for valgrind better analysis")
endif () endif ()

View File

@ -0,0 +1,26 @@
if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32)
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" OFF)
else ()
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ${NOT_UNBUNDLED})
endif ()
option (ENABLE_LIBTCMALLOC "Set to TRUE to enable libtcmalloc" ON)
option (DEBUG_LIBTCMALLOC "Set to TRUE to use debug version of libtcmalloc" OFF)
if (ENABLE_LIBTCMALLOC)
#contrib/libtcmalloc doesnt build debug version, try find in system
if (DEBUG_LIBTCMALLOC OR NOT USE_INTERNAL_GPERFTOOLS_LIBRARY)
find_package (Gperftools)
endif ()
if (NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL) AND NOT (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32))
set (USE_INTERNAL_GPERFTOOLS_LIBRARY 1)
set (GPERFTOOLS_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include")
set (GPERFTOOLS_TCMALLOC_MINIMAL tcmalloc_minimal_internal)
endif ()
if (GPERFTOOLS_FOUND OR USE_INTERNAL_GPERFTOOLS_LIBRARY)
set (USE_TCMALLOC 1)
endif ()
message (STATUS "Using tcmalloc=${USE_TCMALLOC}: ${GPERFTOOLS_INCLUDE_DIR} : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
endif ()