Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/runtime_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ endif()

option(XOCL_VERBOSE "Enable xocl verbosity" OFF)
option(XRT_VERBOSE "Enable xrt verbosity" OFF)
option(XRT_ENABLE_USDT "Enable SystemTap USDT tracepoints" ON)

if (XOCL_VERBOSE)
add_compile_options("-DXOCL_VERBOSE")
Expand All @@ -21,6 +22,18 @@ if(XRT_VERBOSE)
add_compile_options("-DXRT_VERBOSE")
endif()

if (XRT_ENABLE_USDT)
include(CheckIncludeFileCXX)
check_include_file_cxx("sys/sdt.h" XRT_HAVE_SYS_SDT_H)
if (NOT XRT_HAVE_SYS_SDT_H)
message(FATAL_ERROR
"sys/sdt.h not found. Install systemtap-sdt-dev "
"(or systemtap-sdt-devel), or configure with "
"-DXRT_ENABLE_USDT=OFF.")
endif()
add_compile_definitions(XRT_ENABLE_USDT)
endif()

add_compile_options("-fPIC")

if (XRT_ENABLE_WERROR)
Expand Down
11 changes: 9 additions & 2 deletions src/runtime_src/core/common/detail/linux/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#include "core/common/trace.h"

#define SDT_USE_VARIADIC
#include <sys/sdt.h>
#ifdef XRT_ENABLE_USDT
# define SDT_USE_VARIADIC
# include <sys/sdt.h>
#else
# define STAP_PROBEV(provider, name, ...) do {} while (0)
# define DTRACE_PROBE(provider, name) do {} while (0)
# define DTRACE_PROBE1(provider, name, a) do {} while (0)
# define DTRACE_PROBE2(p, n, a, b) do {} while (0)
#endif

#define XRT_DETAIL_TRACE_POINT_LOG(probe, ...) \
STAP_PROBEV(xrt, probe##_log, ##__VA_ARGS__)
Expand Down
Loading