Skip to content

Commit

Permalink
Update CMake files according recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
oshadura committed Sep 25, 2020
1 parent faed250 commit 2194071
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 33 deletions.
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,15 @@ endif()
include(GoogleBenchmark)
include(PytestBenchmark)

if(flamegraphCPU OR flamegraphMem)
if(flamegraph)
# Check if perf is available in OS:
find_program(PERF_EXECUTABLE perf)
if(NOT PERF_EXECUTABLE)
message(WARNING "Perf is not available in your system, please install it.")
set(flamegraph OFF CACHE BOOL "")
else()
include(FlameGraph)
add_custom_target(flamegraph-download DEPENDS FlameGraph)
endif()
include(FlameGraph)
message(STATUS "INFO: CPU & Mem FlameGraph generation option is enabled.")
endif()

#---Add ROOT include direcories and used compilation flags
Expand Down Expand Up @@ -109,4 +108,4 @@ add_subdirectory(tools)

#---Add the now all the benchmark sub-directories on this repository
add_subdirectory(root)
configure_file(${PROJECT_SOURCE_DIR}/rootbench-scripts/.rootrc ${PROJECT_BINARY_DIR} COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/tools/.rootrc ${PROJECT_BINARY_DIR} COPYONLY)
34 changes: 11 additions & 23 deletions cmake/modules/AddRootBench.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,14 @@ endfunction(RB_ADD_SETUP_FIXTURE)
#----------------------------------------------------------------------------
# function RB_ADD_FLAMEGRAPHCPU_FIXTURE(<benchmark>)
#----------------------------------------------------------------------------
function(RB_ADD_FLAMEGRAPHCPU_FIXTURE benchmark)
function(RB_ADD_FLAMEGRAPH_FIXTURE benchmark)
cmake_parse_arguments(ARG "" "" "" ${ARGN})
add_test(NAME rootbench-fixture-flamegraphcpu-${benchmark}
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -c)
set_tests_properties(rootbench-fixture-flamegraphcpu-${benchmark} PROPERTIES FIXTURES_CLEANUP flamegraphcpu-${benchmark})
endfunction(RB_ADD_FLAMEGRAPHCPU_FIXTURE)


#----------------------------------------------------------------------------
# function RB_ADD_FLAMEGRAPHMEM_FIXTURE(<benchmark>)
#----------------------------------------------------------------------------
function(RB_ADD_FLAMEGRAPHMEM_FIXTURE benchmark)
cmake_parse_arguments(ARG "" "" "" ${ARGN})
add_test(NAME rootbench-fixture-flamegraphmem-${benchmark}
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -m)
set_tests_properties(rootbench-fixture-flamegraphmem-${benchmark} PROPERTIES FIXTURES_CLEANUP flamegraphmem-${benchmark})
endfunction(RB_ADD_FLAMEGRAPHMEM_FIXTURE)

add_test(NAME rootbench-fixture-flamegraph-${benchmark}
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -c -m)
set_tests_properties(rootbench-fixture-flamegraph-${benchmark} PROPERTIES
ENVIRONMENT PATH=${PROJECT_BINARY_DIR}/FlameGraph-prefix/src/FlameGraph/:$ENV{PATH}
FIXTURES_CLEANUP rootbench-${benchmark})
endfunction(RB_ADD_FLAMEGRAPH_FIXTURE)


#----------------------------------------------------------------------------
Expand Down Expand Up @@ -86,11 +76,9 @@ function(RB_ADD_GBENCHMARK benchmark)
endif()

# Flamegraphs (both mem and cpu)
if(flamegraphCPU)
RB_ADD_FLAMEGRAPHCPU_FIXTURE(${benchmark})
endif()
if(flamegraphMem)
RB_ADD_FLAMEGRAPHMEM_FIXTURE(${benchmark})
if(flamegraph)
RB_ADD_FLAMEGRAPH_FIXTURE(${benchmark})
add_dependencies(${benchmark} FlameGraph)
endif()

# Add benchmark as a CTest
Expand All @@ -99,7 +87,7 @@ function(RB_ADD_GBENCHMARK benchmark)
set_tests_properties(rootbench-${benchmark} PROPERTIES
ENVIRONMENT LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH}
TIMEOUT "${TIMEOUT_VALUE}" LABELS "${ARG_LABEL}" RUN_SERIAL TRUE
FIXTURES_REQUIRED "setup-${benchmark};download-${benchmark}-datafiles;flamegraphcpu-${benchmark};flamegraphmem-${benchmark}")
FIXTURES_REQUIRED "setup-${benchmark};download-${benchmark}-datafiles")
endfunction(RB_ADD_GBENCHMARK)


Expand Down
4 changes: 1 addition & 3 deletions cmake/modules/FlameGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ include(ExternalProject)
ExternalProject_Add(FlameGraph
GIT_REPOSITORY "https://github.com/brendangregg/FlameGraph.git"
UPDATE_COMMAND ""
PATCH_COMMAND patch < ${CMAKE_SOURCE_DIR}/rootbench-scripts/stackcollapse-perf.patch
#PATCH_COMMAND patch < ${CMAKE_SOURCE_DIR}/tools/stackcollapse-perf.patch
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL 1
)


3 changes: 1 addition & 2 deletions cmake/modules/RootBenchOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
#----------------------------------------------------------------------------
option(coverage OFF)
option(rootbench-datafiles OFF)
option(flamegraphCPU "CPU FlameGraph generation option" OFF)
option(flamegraphMem "Memory FlameGraph generation option" OFF)
option(flamegraph "CPU & Mem FlameGraph generation option" OFF)
1 change: 1 addition & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
configure_file(download_files.sh . COPYONLY)
configure_file(flamegraph.sh . COPYONLY)

0 comments on commit 2194071

Please sign in to comment.