Skip to content

Commit 2194071

Browse files
committed
Update CMake files according recent changes
1 parent faed250 commit 2194071

File tree

5 files changed

+18
-33
lines changed

5 files changed

+18
-33
lines changed

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,15 @@ endif()
6565
include(GoogleBenchmark)
6666
include(PytestBenchmark)
6767

68-
if(flamegraphCPU OR flamegraphMem)
68+
if(flamegraph)
6969
# Check if perf is available in OS:
7070
find_program(PERF_EXECUTABLE perf)
7171
if(NOT PERF_EXECUTABLE)
7272
message(WARNING "Perf is not available in your system, please install it.")
7373
set(flamegraph OFF CACHE BOOL "")
74-
else()
75-
include(FlameGraph)
76-
add_custom_target(flamegraph-download DEPENDS FlameGraph)
7774
endif()
75+
include(FlameGraph)
76+
message(STATUS "INFO: CPU & Mem FlameGraph generation option is enabled.")
7877
endif()
7978

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

110109
#---Add the now all the benchmark sub-directories on this repository
111110
add_subdirectory(root)
112-
configure_file(${PROJECT_SOURCE_DIR}/rootbench-scripts/.rootrc ${PROJECT_BINARY_DIR} COPYONLY)
111+
configure_file(${PROJECT_SOURCE_DIR}/tools/.rootrc ${PROJECT_BINARY_DIR} COPYONLY)

cmake/modules/AddRootBench.cmake

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,14 @@ endfunction(RB_ADD_SETUP_FIXTURE)
3232
#----------------------------------------------------------------------------
3333
# function RB_ADD_FLAMEGRAPHCPU_FIXTURE(<benchmark>)
3434
#----------------------------------------------------------------------------
35-
function(RB_ADD_FLAMEGRAPHCPU_FIXTURE benchmark)
35+
function(RB_ADD_FLAMEGRAPH_FIXTURE benchmark)
3636
cmake_parse_arguments(ARG "" "" "" ${ARGN})
37-
add_test(NAME rootbench-fixture-flamegraphcpu-${benchmark}
38-
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -c)
39-
set_tests_properties(rootbench-fixture-flamegraphcpu-${benchmark} PROPERTIES FIXTURES_CLEANUP flamegraphcpu-${benchmark})
40-
endfunction(RB_ADD_FLAMEGRAPHCPU_FIXTURE)
41-
42-
43-
#----------------------------------------------------------------------------
44-
# function RB_ADD_FLAMEGRAPHMEM_FIXTURE(<benchmark>)
45-
#----------------------------------------------------------------------------
46-
function(RB_ADD_FLAMEGRAPHMEM_FIXTURE benchmark)
47-
cmake_parse_arguments(ARG "" "" "" ${ARGN})
48-
add_test(NAME rootbench-fixture-flamegraphmem-${benchmark}
49-
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -m)
50-
set_tests_properties(rootbench-fixture-flamegraphmem-${benchmark} PROPERTIES FIXTURES_CLEANUP flamegraphmem-${benchmark})
51-
endfunction(RB_ADD_FLAMEGRAPHMEM_FIXTURE)
52-
37+
add_test(NAME rootbench-fixture-flamegraph-${benchmark}
38+
COMMAND ${PROJECT_BINARY_DIR}/tools/flamegraph.sh -d ${PROJECT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/${benchmark} -c -m)
39+
set_tests_properties(rootbench-fixture-flamegraph-${benchmark} PROPERTIES
40+
ENVIRONMENT PATH=${PROJECT_BINARY_DIR}/FlameGraph-prefix/src/FlameGraph/:$ENV{PATH}
41+
FIXTURES_CLEANUP rootbench-${benchmark})
42+
endfunction(RB_ADD_FLAMEGRAPH_FIXTURE)
5343

5444

5545
#----------------------------------------------------------------------------
@@ -86,11 +76,9 @@ function(RB_ADD_GBENCHMARK benchmark)
8676
endif()
8777

8878
# Flamegraphs (both mem and cpu)
89-
if(flamegraphCPU)
90-
RB_ADD_FLAMEGRAPHCPU_FIXTURE(${benchmark})
91-
endif()
92-
if(flamegraphMem)
93-
RB_ADD_FLAMEGRAPHMEM_FIXTURE(${benchmark})
79+
if(flamegraph)
80+
RB_ADD_FLAMEGRAPH_FIXTURE(${benchmark})
81+
add_dependencies(${benchmark} FlameGraph)
9482
endif()
9583

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

10593

cmake/modules/FlameGraph.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ include(ExternalProject)
33
ExternalProject_Add(FlameGraph
44
GIT_REPOSITORY "https://github.com/brendangregg/FlameGraph.git"
55
UPDATE_COMMAND ""
6-
PATCH_COMMAND patch < ${CMAKE_SOURCE_DIR}/rootbench-scripts/stackcollapse-perf.patch
6+
#PATCH_COMMAND patch < ${CMAKE_SOURCE_DIR}/tools/stackcollapse-perf.patch
77
CONFIGURE_COMMAND ""
88
BUILD_COMMAND ""
99
INSTALL_COMMAND ""
1010
EXCLUDE_FROM_ALL 1
1111
)
12-
13-

cmake/modules/RootBenchOptions.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
#----------------------------------------------------------------------------
66
option(coverage OFF)
77
option(rootbench-datafiles OFF)
8-
option(flamegraphCPU "CPU FlameGraph generation option" OFF)
9-
option(flamegraphMem "Memory FlameGraph generation option" OFF)
8+
option(flamegraph "CPU & Mem FlameGraph generation option" OFF)

tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
configure_file(download_files.sh . COPYONLY)
2+
configure_file(flamegraph.sh . COPYONLY)

0 commit comments

Comments
 (0)