8feb6bf8b6
- The primary feature of this PR is the **addition of support for scoping the collection of tracing/profiling data into one or more time-based windows** - Closes #222 - Closes #207 - Support for a real-clock time delay and/or a duration for tracing/profiling was added, *resembling the support for this feature during sampling and process-sampling* - However, above paradigm was enhanced for tracing - Instead of one delay and/or one duration based on real time, ***tracing supports periodic and varying delays and durations and these delay+duration sets can be controlled with different clocks*** - At some point, this capability will be extended to sampling and process-sampling - A secondary feature of this PR are the improvements to the handling of categories (by-product of the primary feature) - For example, previously setting `OMNITRACE_ENABLE_CATEGORIES` to a specific set of categories only eliminated the disabled categories from the perfetto trace, now these are applied to timemory profiles too - A new configuration variable `OMNITRACE_DISABLE_CATEGORIES` was added for when disabling only a handful of categories is easier - There are quite a few miscellaneous modifications which pollute this PR a bit ## Multiple Tracing Windows As noted above, tracing now supports specifying multiple delays and durations _and_ with different clocks. Consider the configuration below with two entries in the format `<DELAY>:<DURATION>:<REPEAT>:<CLOCK_TYPE>`: ```console OMNITRACE_TRACE_PERIODS = 0.5:1.0:2:realtime 10.0:5.0:3:cputime ``` The above configuration defines: 1. `0.5:1.0:2:realtime` - A delay of 0.5 seconds (real-time) - Followed by a data collection duration of 1 second (real-time) - This delay + duration is repeated 2x - Summary: tracing data is collected for 2 out of the first 3 seconds of the application's execution 2. `10.0:5.0:3:cputime` - A delay of 10 seconds (process _CPU-time_) - Followed by a data collection duration of 5 seconds (process _CPU-time_) - This delay + duration is repeated 3x - Summary: tracing data is collected for a total of 15 seconds of process CPU-time in the ensuing 75 seconds of CPU-time during the application execution. - Note: the elapsed CPU-time is the aggregate of the CPU-time consumed by all the threads in the process and should be scaled accordingly, e.g., 4 threads running constantly for 1 second of real-time is ~4 seconds of CPU time. ## `omnitrace-sample` Changes Formerly, `--wait` and `--duration` command-line options only applied to sampling delay and duration. The value of these options are now applied to the tracing delay and duration. To retain the ability to control sampling delay/duration without setting tracing delay/duration or vice versa, `--sampling-wait`, `--sampling-duration`, `--trace-wait`, and `--trace-duration` options were added. `omnitrace-sample` also has new options for most of the new configuration options detailed below. ## New configuration options | Option | Description | | ------- | ----------- | | `OMNITRACE_DISABLE_CATEGORIES` | inverse behavior from `OMNITRACE_ENABLE_CATEGORIES` -- populates list of all available categories and then removes the specified ones. | | `OMNITRACE_TRACE_DELAY` | Single floating-point number specifying time to wait before starting data collection. Analagous to `OMNITRACE_SAMPLING_DELAY` and `OMNITRACE_PROCESS_SAMPLING_DELAY` | | `OMNITRACE_TRACE_DURATION` | Single floating-point number specifying data collection duration. Analagous to `OMNITRACE_SAMPLING_DURATION` and `OMNITRACE_PROCESS_SAMPLING_DURATION` | | `OMNITRACE_TRACE_PERIOD_CLOCK_ID` | Sets the default clock-type for tracing delay/duration. Always applied to above two options, can be overridden in below option. Accepts `CLOCK_REALTIME`, `CLOCK_MONOTONIC`, `CLOCK_PROCESS_CPUTIME_ID`, `CLOCK_MONOTONIC_RAW`, `CLOCK_REALTIME_COARSE`, `CLOCK_MONOTONIC_COARSE`, `CLOCK_BOOTTIME`. See `man 2 clock_gettime` for details on differences. | | `OMNITRACE_TRACE_PERIODS` | More powerful version for specifying delay + duration. Supports formats: `<DELAY>`, `<DELAY>:<DURATION>`, `<DELAY>:<DURATION>:<REPEAT>`, and `<DELAY>:<DURATION>:<REPEAT>:<CLOCK_ID>`. | ## Miscellaneous Changes - Expanded `critical_trace_categories_t` to include tracing data from MPI, pthread, HIP, HSA, RCCL, NUMA, and Python. - Added categories `thread_wall_time` and `thread_cpu_time` (derived from sampling) - Read DWARF info for breakpoints - Relocated some source code - Reason: necessary to make `libomnitrace` a bit more modular. Eventually, a large chunk will be separated into `libomnitrace-core`, `libomnitrace-binary`, etc. in order to facilitate re-usability - Relocated some functionality from `runtime.cpp` to `config.cpp` - Relocated code using rocm-smi library to query number of devices to `gpu.cpp` (where the code for using HIP to query number of devices is) - Relocated code for perfetto config and perfetto session out of tracing namespace to reside with other perfetto code - `OMNITRACE_COLORIZED_LOG` configuration option renamed to `OMNITRACE_MONOCHROME` - Backwards compatibility via a deprecated option was not retained here since the logic changed (i.e. true in former means false in latter) - Replaced `TIMEMORY_DEFAULT_OBJECT` macro with `OMNITRACE_DEFAULT_OBJECT` macro - Updated some code in roctracer to use `component::category_region` instead of explicitly using `tracing::` functions - Updated `backtrace_metrics` to better support controlling their presence in the traces/profiles via categories - Added support for `--print` in `validate-timemory-json.py` - Generic `OMNITRACE_ADD_VALIDATION_TEST` CMake function ## Git Log * OMNITRACE_DEFAULT_OBJECT - replace TIMEMORY_DEFAULT_OBJECT with TIMEMORY_DEFAULT_OBJECT * trace-time-window example + tests - adds cmake OMNITRACE_ADD_VALIDATION_TEST function for testing - validate-timemory-json.py now supports printing (-p) - update to OMNITRACE_STRIP_TARGET * Update timemory submodule - detailed backtrace print /proc/<PID>/maps - operation::push_node verbosity change - storage::insert_hierarchy use emplace + at instead of operator[] - concepts::is_type_listing - argparse updates for start/end group - argparse color fixes * perfetto updates - Remove OMNITRACE_CUSTOM_DATA_SOURCE CMake option - move tracing::get_perfetto_config and tracing::get_perfetto_session to perfetto.cpp * config and runtime updates - OMNITRACE_DISABLE_CATEGORIES option - get_enabled_categories() + get_disabled_categories() - config impl handles populating them - OMNITRACE_TRACE_DELAY option - OMNITRACE_TRACE_DURATION option - OMNITRACE_TRACE_PERIODS option - {get,set}_signal_handler - removes config.cpp link dependency for omnitrace_finalize - get_realtime_signal() + get_cputime_signal() + get_sampling_signals() - moved from runtime.cpp to config.cpp * utility::convert - helper function for converting string to a type * pthread_create_gotcha + thread_info updates - thread_index_data::as_string() - tweak printing info about new thread / exited thread * binary updates - get_binary_info has arg to disable dwarf parsing - binary_info contains vector of breakpoint addresses - binary_info:filename() function - binary::get_linked_path - binary::get_link_map has args for dlopen mode - symbol::read_dwarf -> symbol::read_dwarf_entries - symbol::read_dwarf_breakpoints * library updates + categories impl - implement config::set_signal_handler - categories.cpp for handling trace delays - implement trace delay/duration/periods * concepts + debug + defines - tuple_element in concepts - removed runtime header from debug header - OMNITRACE_DEFAULT_COPY_MOVE * gpu + rocm_smi - moved rsmi_num_monitor_devices call to gpu.cpp - gpu::rsmi_device_count() * roctracer updates - roctracer_bundle_t -> roctracer_hip_bundle_t - use category_region instead of explicit tracing push/pop calls * sampling + backtrace_metrics - rework backtrace_metrics to support categories * tracing updates - category stack counters (i.e. push vs. pop counter) for profiling and tracing - push_timemory and pop_timemory accept string_view instead of const char* - tweaked the pop_timemory hash search - {push,pop}_perfetto theoretically supports same invocations as for {push,pop}_perfetto_ts and {push,pop}_perfetto_track - mark_perfetto, mark_perfetto_ts, mark_perfetto_track * category_region update - expanded the critical trace categories - use category_push_disabled - use category_pop_disabled - use category_mark_disabled * constraint implementation - This provides generic functionality for constraining data collection within a windows of time. - E.g., delay, delay + duration, (delay + duration) * nrepeat * COLORIZED_LOG -> MONOCHROME * constraint + omnitrace-causal + omnitrace-sample updates - support for using different clock IDs for constraints - OMNITRACE_TRACE_PERIOD_CLOCK_ID option - tweak to trace-time-window example - tweak to trace-time-window tests * Fix formatting * Update time-window tests - Fix detection of validation support for perfetto - Using the --caller-include feature + runtime instrumentation on Ubuntu 18.04 and OpenSUSE 15.2 results in a segfault in the internals of Dyninst. - For now, mark that these tests will fail - Later, determine if updating Dyninst submodule fixes this problem * Fix OMNITRACE_OUTPUT_PATH for all tests - Provide absolute path instead of relative * Tweak lambda for checking whether HW counters are enabled - causing strange build errors on older GCC compilers * Update dyninst submodule - fix issues with using --caller-include for Ubuntu 18.04, OpenSUSE 15.x * cmake formatting * fix sampling compiler issue for GCC 8 * Tweak thread create message * Increase causal validation iterations
407 lines
15 KiB
CMake
407 lines
15 KiB
CMake
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL
|
|
CMAKE_SOURCE_DIR)
|
|
set(MSG "")
|
|
message(STATUS "Warning! Building from the source directory is not recommended")
|
|
message(STATUS "If unintented, please remove 'CMakeCache.txt' and 'CMakeFiles'")
|
|
message(STATUS "and build from a separate directory")
|
|
message(AUTHOR_WARNING "In-source build")
|
|
endif()
|
|
|
|
if(NOT UNIX OR APPLE)
|
|
message(
|
|
AUTHOR_WARNING
|
|
"omnitrace only supports Linux. Configure and/or build is likely to fail")
|
|
endif()
|
|
|
|
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
|
|
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
|
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" OMNITRACE_VERSION
|
|
"${FULL_VERSION_STRING}")
|
|
|
|
project(
|
|
omnitrace
|
|
LANGUAGES C CXX
|
|
VERSION ${OMNITRACE_VERSION}
|
|
DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation"
|
|
HOMEPAGE_URL "https://github.com/AMDResearch/omnitrace")
|
|
|
|
find_package(Git)
|
|
|
|
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} describe --tags
|
|
OUTPUT_VARIABLE OMNITRACE_GIT_DESCRIBE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
|
ERROR_QUIET)
|
|
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} describe
|
|
OUTPUT_VARIABLE OMNITRACE_GIT_DESCRIBE
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
|
ERROR_QUIET)
|
|
endif()
|
|
execute_process(
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
OUTPUT_VARIABLE OMNITRACE_GIT_REVISION
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
else()
|
|
set(OMNITRACE_GIT_DESCRIBE "v${OMNITRACE_VERSION}")
|
|
set(OMNITRACE_GIT_REVISION "")
|
|
endif()
|
|
|
|
message(
|
|
STATUS
|
|
"[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})"
|
|
)
|
|
message(STATUS "[${PROJECT_NAME}] git revision: ${OMNITRACE_GIT_REVISION}")
|
|
message(STATUS "[${PROJECT_NAME}] git describe: ${OMNITRACE_GIT_DESCRIBE}")
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake/Modules
|
|
${PROJECT_SOURCE_DIR}/source/python/cmake ${CMAKE_MODULE_PATH})
|
|
set(BUILD_SHARED_LIBS
|
|
ON
|
|
CACHE BOOL "Build shared libraries")
|
|
set(BUILD_STATIC_LIBS
|
|
OFF
|
|
CACHE BOOL "Build static libraries")
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE
|
|
ON
|
|
CACHE BOOL "Build position independent code")
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
set(CMAKE_BUILD_TYPE
|
|
Release
|
|
CACHE STRING "Build type" FORCE)
|
|
else()
|
|
set(VALID_BUILD_TYPES "Release" "RelWithDebInfo" "Debug" "MinSizeRel")
|
|
if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST VALID_BUILD_TYPES)
|
|
string(REPLACE ";" ", " _VALID_BUILD_TYPES "${VALID_BUILD_TYPES}")
|
|
message(
|
|
FATAL_ERROR
|
|
"Invalid CMAKE_BUILD_TYPE :: ${CMAKE_BUILD_TYPE}. Valid build types are: ${_VALID_BUILD_TYPES}"
|
|
)
|
|
endif()
|
|
endif()
|
|
set(_STRIP_LIBRARIES_DEFAULT OFF)
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|
set(_STRIP_LIBRARIES_DEFAULT ON)
|
|
endif()
|
|
|
|
if(DEFINED CMAKE_INSTALL_LIBDIR AND NOT DEFINED CMAKE_DEFAULT_INSTALL_LIBDIR)
|
|
# always have a fresh install
|
|
unset(CMAKE_INSTALL_LIBDIR CACHE)
|
|
include(GNUInstallDirs) # install directories
|
|
# force this because dyninst always installs to lib
|
|
set(CMAKE_DEFAULT_INSTALL_LIBDIR
|
|
"${CMAKE_INSTALL_LIBDIR}"
|
|
CACHE STRING "Object code libraries" FORCE)
|
|
endif()
|
|
|
|
if(NOT "$ENV{OMNITRACE_CI}" STREQUAL "")
|
|
set(CI_BUILD $ENV{OMNITRACE_CI})
|
|
else()
|
|
set(CI_BUILD OFF)
|
|
endif()
|
|
|
|
include(GNUInstallDirs) # install directories
|
|
include(MacroUtilities) # various functions and macros
|
|
|
|
if(CI_BUILD)
|
|
omnitrace_add_option(OMNITRACE_BUILD_CI "Enable internal asserts, etc." ON ADVANCED
|
|
NO_FEATURE)
|
|
omnitrace_add_option(OMNITRACE_BUILD_TESTING "Enable building the testing suite" ON
|
|
ADVANCED)
|
|
omnitrace_add_option(OMNITRACE_BUILD_DEBUG
|
|
"Enable building with extensive debug symbols" OFF ADVANCED)
|
|
omnitrace_add_option(
|
|
OMNITRACE_BUILD_HIDDEN_VISIBILITY
|
|
"Build with hidden visibility (disable for Debug builds)" OFF ADVANCED)
|
|
omnitrace_add_option(OMNITRACE_STRIP_LIBRARIES "Strip the libraries" OFF ADVANCED)
|
|
else()
|
|
omnitrace_add_option(OMNITRACE_BUILD_CI "Enable internal asserts, etc." OFF ADVANCED
|
|
NO_FEATURE)
|
|
omnitrace_add_option(OMNITRACE_BUILD_EXAMPLES "Enable building the examples" OFF
|
|
ADVANCED)
|
|
omnitrace_add_option(OMNITRACE_BUILD_TESTING "Enable building the testing suite" OFF
|
|
ADVANCED)
|
|
omnitrace_add_option(OMNITRACE_BUILD_DEBUG
|
|
"Enable building with extensive debug symbols" OFF ADVANCED)
|
|
omnitrace_add_option(
|
|
OMNITRACE_BUILD_HIDDEN_VISIBILITY
|
|
"Build with hidden visibility (disable for Debug builds)" ON ADVANCED)
|
|
omnitrace_add_option(OMNITRACE_STRIP_LIBRARIES "Strip the libraries"
|
|
${_STRIP_LIBRARIES_DEFAULT} ADVANCED)
|
|
endif()
|
|
|
|
include(Compilers) # compiler identification
|
|
include(BuildSettings) # compiler flags
|
|
|
|
set(CMAKE_INSTALL_LIBDIR
|
|
"lib"
|
|
CACHE STRING "Object code libraries (lib)" FORCE)
|
|
set(CMAKE_CXX_STANDARD
|
|
17
|
|
CACHE STRING "CXX language standard")
|
|
|
|
omnitrace_add_feature(CMAKE_BUILD_TYPE "Build optimization level")
|
|
omnitrace_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix")
|
|
omnitrace_add_feature(CMAKE_CXX_COMPILER "C++ compiler")
|
|
omnitrace_add_feature(CMAKE_CXX_STANDARD "CXX language standard")
|
|
omnitrace_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON)
|
|
omnitrace_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF)
|
|
omnitrace_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Enable rpath to linked libraries"
|
|
ON)
|
|
set(CMAKE_INSTALL_MESSAGE
|
|
"LAZY"
|
|
CACHE STRING "Installation message")
|
|
mark_as_advanced(CMAKE_INSTALL_MESSAGE)
|
|
|
|
omnitrace_add_option(OMNITRACE_USE_CLANG_TIDY "Enable clang-tidy" OFF)
|
|
omnitrace_add_option(OMNITRACE_USE_BFD
|
|
"Enable BFD support (map call-stack samples to LOC)" ON)
|
|
omnitrace_add_option(OMNITRACE_USE_MPI "Enable MPI support" OFF)
|
|
omnitrace_add_option(OMNITRACE_USE_HIP "Enable HIP support" ON)
|
|
omnitrace_add_option(OMNITRACE_USE_PAPI "Enable HW counter support via PAPI" ON)
|
|
omnitrace_add_option(OMNITRACE_USE_ROCTRACER "Enable roctracer support"
|
|
${OMNITRACE_USE_HIP})
|
|
omnitrace_add_option(OMNITRACE_USE_ROCPROFILER "Enable rocprofiler support"
|
|
${OMNITRACE_USE_HIP})
|
|
omnitrace_add_option(
|
|
OMNITRACE_USE_ROCM_SMI "Enable rocm-smi support for power/temp/etc. sampling"
|
|
${OMNITRACE_USE_HIP})
|
|
omnitrace_add_option(OMNITRACE_USE_RCCL "Enable RCCL support" ${OMNITRACE_USE_HIP})
|
|
omnitrace_add_option(OMNITRACE_USE_MPI_HEADERS
|
|
"Enable wrapping MPI functions w/o enabling MPI dependency" ON)
|
|
omnitrace_add_option(OMNITRACE_USE_OMPT "Enable OpenMP tools support" ON)
|
|
omnitrace_add_option(OMNITRACE_USE_PYTHON "Enable Python support" OFF)
|
|
omnitrace_add_option(OMNITRACE_BUILD_DYNINST "Build dyninst from submodule" OFF)
|
|
omnitrace_add_option(OMNITRACE_BUILD_LIBUNWIND "Build libunwind from submodule" ON)
|
|
omnitrace_add_option(OMNITRACE_BUILD_CODECOV "Build for code coverage" OFF)
|
|
omnitrace_add_option(OMNITRACE_INSTALL_PERFETTO_TOOLS
|
|
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF)
|
|
|
|
if(OMNITRACE_USE_PAPI)
|
|
omnitrace_add_option(OMNITRACE_BUILD_PAPI "Build PAPI from submodule" ON)
|
|
endif()
|
|
|
|
if(OMNITRACE_USE_PYTHON)
|
|
omnitrace_add_option(OMNITRACE_BUILD_PYTHON
|
|
"Build python bindings with internal pybind11" ON)
|
|
elseif("$ENV{OMNITRACE_CI}")
|
|
# quiet warnings in dashboard
|
|
if(OMNITRACE_PYTHON_ENVS OR OMNITRACE_PYTHON_PREFIX)
|
|
omnitrace_message(
|
|
STATUS
|
|
"Ignoring values of OMNITRACE_PYTHON_ENVS and/or OMNITRACE_PYTHON_PREFIX")
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT OMNITRACE_USE_HIP)
|
|
set(OMNITRACE_USE_ROCTRACER
|
|
OFF
|
|
CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE)
|
|
set(OMNITRACE_USE_ROCPROFILER
|
|
OFF
|
|
CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE)
|
|
set(OMNITRACE_USE_ROCM_SMI
|
|
OFF
|
|
CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE)
|
|
set(OMNITRACE_USE_RCCL
|
|
OFF
|
|
CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE)
|
|
elseif(
|
|
OMNITRACE_USE_HIP
|
|
AND NOT OMNITRACE_USE_ROCTRACER
|
|
AND NOT OMNITRACE_USE_ROCPROFILER
|
|
AND NOT OMNITRACE_USE_ROCM_SMI
|
|
AND NOT OMNITRACE_USE_RCCL)
|
|
omnitrace_message(
|
|
AUTHOR_WARNING
|
|
"Setting OMNITRACE_USE_HIP=OFF because roctracer, rocprofiler, rccl, and rocm-smi options are disabled"
|
|
)
|
|
set(OMNITRACE_USE_HIP OFF)
|
|
endif()
|
|
|
|
if(OMNITRACE_BUILD_TESTING)
|
|
set(OMNITRACE_BUILD_EXAMPLES
|
|
ON
|
|
CACHE BOOL "Enable building the examples" FORCE)
|
|
endif()
|
|
|
|
include(ProcessorCount)
|
|
processorcount(OMNITRACE_PROCESSOR_COUNT)
|
|
math(EXPR OMNITRACE_THREAD_COUNT "16 * ${OMNITRACE_PROCESSOR_COUNT}")
|
|
if(OMNITRACE_THREAD_COUNT LESS 128)
|
|
set(OMNITRACE_THREAD_COUNT 128)
|
|
endif()
|
|
set(OMNITRACE_MAX_THREADS
|
|
"${OMNITRACE_THREAD_COUNT}"
|
|
CACHE
|
|
STRING
|
|
"Maximum number of threads in the host application. Likely only needs to be increased if host app does not use thread-pool but creates many threads"
|
|
)
|
|
omnitrace_add_feature(
|
|
OMNITRACE_MAX_THREADS
|
|
"Maximum number of total threads supported in the host application (default: max of 128 or 16 * nproc)"
|
|
)
|
|
set(OMNITRACE_MAX_UNWIND_DEPTH
|
|
"64"
|
|
CACHE
|
|
STRING
|
|
"Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory"
|
|
)
|
|
omnitrace_add_feature(
|
|
OMNITRACE_MAX_UNWIND_DEPTH
|
|
"Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory"
|
|
)
|
|
|
|
# default visibility settings
|
|
set(CMAKE_C_VISIBILITY_PRESET
|
|
"default"
|
|
CACHE STRING "Visibility preset for non-inline C functions")
|
|
set(CMAKE_CXX_VISIBILITY_PRESET
|
|
"default"
|
|
CACHE STRING "Visibility preset for non-inline C++ functions/objects")
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN
|
|
OFF
|
|
CACHE BOOL "Visibility preset for inline functions")
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
include(Formatting) # format target
|
|
include(Packages) # finds third-party libraries
|
|
|
|
omnitrace_activate_clang_tidy()
|
|
|
|
# custom visibility settings
|
|
if(OMNITRACE_BUILD_HIDDEN_VISIBILITY)
|
|
set(CMAKE_C_VISIBILITY_PRESET "internal")
|
|
set(CMAKE_CXX_VISIBILITY_PRESET "internal")
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
endif()
|
|
|
|
if(OMNITRACE_BUILD_TESTING OR "$ENV{OMNITRACE_CI}" MATCHES "[1-9]+|ON|on|y|yes")
|
|
enable_testing()
|
|
include(CTest)
|
|
endif()
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# library and executables
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core)
|
|
|
|
if(OMNITRACE_BUILD_CODECOV)
|
|
omnitrace_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
|
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
|
|
omnitrace_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE}
|
|
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
|
|
endforeach()
|
|
|
|
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
|
|
set(CMAKE_C_FLAGS_${_BUILD_TYPE}
|
|
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage"
|
|
)
|
|
set(CMAKE_CXX_FLAGS_${_BUILD_TYPE}
|
|
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage"
|
|
)
|
|
endforeach()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
|
endif()
|
|
|
|
add_subdirectory(source)
|
|
|
|
if(OMNITRACE_BUILD_CODECOV)
|
|
omnitrace_restore_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
|
|
|
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
|
|
omnitrace_restore_variables(
|
|
CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE}
|
|
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
|
|
endforeach()
|
|
endif()
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# miscellaneous installs
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
if(NOT OMNITRACE_USE_ROCTRACER AND NOT OMNITRACE_USE_ROCPROFILER)
|
|
set(OMNITRACE_HSA_ENV "# ")
|
|
endif()
|
|
|
|
if(NOT OMNITRACE_USE_ROCPROFILER)
|
|
set(OMNITRACE_ROCP_ENV "# ")
|
|
endif()
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/omnitrace.cfg
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/omnitrace.cfg
|
|
COPYONLY)
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/cmake/Templates/setup-env.sh.in
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh @ONLY)
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION}
|
|
@ONLY)
|
|
|
|
install(
|
|
FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/omnitrace.cfg
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
|
|
COMPONENT setup)
|
|
|
|
install(
|
|
FILES
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION}
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}
|
|
COMPONENT setup)
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# examples
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_BUILD_EXAMPLES)
|
|
add_subdirectory(examples)
|
|
endif()
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# tests
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_BUILD_TESTING)
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# packaging
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core)
|
|
include(ConfigInstall)
|
|
include(ConfigCPack)
|
|
|
|
# ------------------------------------------------------------------------------#
|
|
#
|
|
# config info
|
|
#
|
|
# ------------------------------------------------------------------------------#
|
|
|
|
omnitrace_print_features()
|