ovni/cmake/CheckPerfParanoid.cmake
Rodrigo Arias 37a567299e Add a fibonacci test to cause context switches
The test creates tasks that pause until the children task have finished.
The value of the perf_event_paranoid file is checked to determine if we
can run the test.
2024-03-21 17:07:19 +01:00

21 lines
757 B
CMake

# Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
# SPDX-License-Identifier: GPL-3.0-or-later
if(EXISTS "/proc/sys/kernel/perf_event_paranoid")
file(READ "/proc/sys/kernel/perf_event_paranoid" paranoid_raw)
string(REPLACE "\n" "" paranoid_value "${paranoid_raw}")
message(STATUS "Value of /proc/sys/kernel/perf_event_paranoid is ${paranoid_value}")
if(paranoid_value LESS_EQUAL 1)
message(STATUS "Value of perf_event_paranoid suitable for Kernel tests")
set(PERF_PARANOID_KERNEL ON)
else()
message(STATUS "Value of perf_event_paranoid NOT suitable for Kernel tests")
set(PERF_PARANOID_KERNEL OFF)
endif()
else()
message(STATUS "Missing /proc/sys/kernel/perf_event_paranoid")
set(PERF_PARANOID_KERNEL OFF)
endif()