diff --git a/CMakeLists.txt b/CMakeLists.txt index 4890f7387..0b51dd094 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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) diff --git a/cmake/modules/AddRootBench.cmake b/cmake/modules/AddRootBench.cmake index 511cb3768..988547722 100644 --- a/cmake/modules/AddRootBench.cmake +++ b/cmake/modules/AddRootBench.cmake @@ -32,24 +32,14 @@ endfunction(RB_ADD_SETUP_FIXTURE) #---------------------------------------------------------------------------- # function RB_ADD_FLAMEGRAPHCPU_FIXTURE() #---------------------------------------------------------------------------- -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() -#---------------------------------------------------------------------------- -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) #---------------------------------------------------------------------------- @@ -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 @@ -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) diff --git a/cmake/modules/FlameGraph.cmake b/cmake/modules/FlameGraph.cmake index 78830a3da..b7e38330d 100644 --- a/cmake/modules/FlameGraph.cmake +++ b/cmake/modules/FlameGraph.cmake @@ -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 ) - - diff --git a/cmake/modules/RootBenchOptions.cmake b/cmake/modules/RootBenchOptions.cmake index 8c9de1081..5311178eb 100644 --- a/cmake/modules/RootBenchOptions.cmake +++ b/cmake/modules/RootBenchOptions.cmake @@ -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) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e18fc0eb6..a06535c02 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1 +1,2 @@ configure_file(download_files.sh . COPYONLY) +configure_file(flamegraph.sh . COPYONLY)