From: Kefu Chai Date: Thu, 26 Jul 2018 05:41:55 +0000 (+0800) Subject: cmake: make heap_profiler a library target X-Git-Tag: v14.0.1~756^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b21903eabfff121e697ec7f48eec182a4d1ea101;p=ceph.git cmake: make heap_profiler a library target Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 09d655525d4d..74ed9a0ce952 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,6 +315,8 @@ if(ALLOCATOR) elseif(${ALLOCATOR} STREQUAL "jemalloc") find_package(JeMalloc REQUIRED) set(HAVE_JEMALLOC 1) + elseif(NOT ALLOCATOR STREQUAL "libc") + message(FATAL_ERROR "Unsupported allocator selected: ${ALLOCATOR}") endif() else(ALLOCATOR) find_package(gperftools) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87d76cdbeaa9..40b5f9a84167 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -301,26 +301,14 @@ endif(HAVE_XIO) if(ALLOCATOR STREQUAL "tcmalloc") set(ALLOC_LIBS gperftools::tcmalloc) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") - set(TCMALLOC_srcs perfglue/heap_profiler.cc) elseif(ALLOCATOR STREQUAL "tcmalloc_minimal") set(ALLOC_LIBS gperftools::tcmalloc_minimal) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") - set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc) elseif(ALLOCATOR STREQUAL "jemalloc") set(ALLOC_LIBS JeMalloc::JeMalloc) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") - set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc) -elseif(ALLOCATOR STREQUAL "libc") - set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc) -else() - set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc) - message(FATAL_ERROR "Unsupported allocator selected: ${ALLOCATOR}") endif() -# tcmalloc heap profiler -set(heap_profiler_files ${TCMALLOC_srcs}) -add_library(heap_profiler_objs OBJECT ${heap_profiler_files}) - if (WITH_BLKIN) add_subdirectory(blkin/blkin-lib) endif(WITH_BLKIN) @@ -751,6 +739,9 @@ add_subdirectory(cls) # RADOS client/library add_subdirectory(osdc) +# heal_profiler +add_subdirectory(perfglue) + add_library(rados_snap_set_diff_obj OBJECT librados/snap_set_diff.cc) add_subdirectory(include) @@ -779,11 +770,12 @@ if (WITH_MGR) mgr/Mgr.cc mgr/Gil.cc mgr/mgr_commands.cc) - add_executable(ceph-mgr ${mgr_srcs} - $) + add_executable(ceph-mgr ${mgr_srcs}) target_include_directories(ceph-mgr SYSTEM PRIVATE "${PYTHON_INCLUDE_DIRS}") - target_link_libraries(ceph-mgr osdc client global-static ceph-common - Boost::python ${MGR_PYTHON_LIBRARIES} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} ${ALLOC_LIBS}) + target_link_libraries(ceph-mgr + osdc client heap_profiler + global-static ceph-common + Boost::python ${MGR_PYTHON_LIBRARIES} ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} ${ALLOC_LIBS}) install(TARGETS ceph-mgr DESTINATION bin) endif (WITH_MGR) diff --git a/src/mds/CMakeLists.txt b/src/mds/CMakeLists.txt index e5acccc73ccc..42220805e4e5 100644 --- a/src/mds/CMakeLists.txt +++ b/src/mds/CMakeLists.txt @@ -42,6 +42,5 @@ set(mds_srcs ${CMAKE_SOURCE_DIR}/src/common/TrackedOp.cc ${CMAKE_SOURCE_DIR}/src/common/MemoryModel.cc ${CMAKE_SOURCE_DIR}/src/osdc/Journaler.cc) -add_library(mds STATIC ${mds_srcs} - $) -target_link_libraries(mds ${ALLOC_LIBS} osdc liblua) +add_library(mds STATIC ${mds_srcs}) +target_link_libraries(mds heap_profiler ${ALLOC_LIBS} osdc liblua) diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt index c8e2edbd7116..1f835a22c715 100644 --- a/src/mon/CMakeLists.txt +++ b/src/mon/CMakeLists.txt @@ -25,6 +25,5 @@ set(lib_mon_srcs ../osd/OSDCap.cc) add_library(mon STATIC ${lib_mon_srcs} - $ - $) -target_link_libraries(mon ${ALLOC_LIBS}) + $) +target_link_libraries(mon heap_profiler ${ALLOC_LIBS}) diff --git a/src/osd/CMakeLists.txt b/src/osd/CMakeLists.txt index 7ed2e736905c..fa7d20dcac41 100644 --- a/src/osd/CMakeLists.txt +++ b/src/osd/CMakeLists.txt @@ -42,9 +42,10 @@ if(HAS_VTA) endif() add_library(osd STATIC ${osd_srcs} $ - $ - $) -target_link_libraries(osd ${LEVELDB_LIBRARIES} dmclock ${CMAKE_DL_LIBS} ${ALLOC_LIBS}) + $) +target_link_libraries(osd + ${LEVELDB_LIBRARIES} + dmclock heap_profiler ${CMAKE_DL_LIBS} ${ALLOC_LIBS}) if(WITH_LTTNG) add_dependencies(osd osd-tp pg-tp) endif() diff --git a/src/perfglue/CMakeLists.txt b/src/perfglue/CMakeLists.txt new file mode 100644 index 000000000000..f467209a65bc --- /dev/null +++ b/src/perfglue/CMakeLists.txt @@ -0,0 +1,9 @@ +if(ALLOCATOR STREQUAL "tcmalloc") + add_library(heap_profiler STATIC + heap_profiler.cc) + target_link_libraries(heap_profiler + gperftools::tcmalloc) +else() + add_library(heap_profiler STATIC + disabled_heap_profiler.cc) +endif()