2016-07-21 15:39:55 +08:00
|
|
|
# Build for the XRay runtime support library.
|
|
|
|
|
2017-01-03 12:04:00 +08:00
|
|
|
# Core XRay runtime library implementation files.
|
2016-07-21 15:39:55 +08:00
|
|
|
set(XRAY_SOURCES
|
|
|
|
xray_init.cc
|
[XRay][compiler-rt] XRay Flight Data Recorder Mode
Summary:
In this change we introduce the notion of a "flight data recorder" mode
for XRay logging, where XRay logs in-memory first, and write out data
on-demand as required (as opposed to the naive implementation that keeps
logging while tracing is "on"). This depends on D26232 where we
implement the core data structure for holding the buffers that threads
will be using to write out records of operation.
This implementation only currently works on x86_64 and depends heavily
on the TSC math to write out smaller records to the inmemory buffers.
Also, this implementation defines two different kinds of records with
different sizes (compared to the current naive implementation): a
MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord
entries are meant to write out information like the thread ID for which
the metadata record is defined for, whether the execution of a thread
moved to a different CPU, etc. while a FunctionRecord represents the
different kinds of function call entry/exit records we might encounter
in the course of a thread's execution along with a delta from the last
time the logging handler was called.
While this implementation is not exactly what is described in the
original XRay whitepaper, this one gives us an initial implementation
that we can iterate and build upon.
Reviewers: echristo, rSerge, majnemer
Subscribers: mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D27038
llvm-svn: 290852
2017-01-03 11:38:17 +08:00
|
|
|
xray_interface.cc
|
2017-01-03 12:04:00 +08:00
|
|
|
xray_flags.cc
|
|
|
|
xray_inmemory_log.cc)
|
|
|
|
|
|
|
|
# XRay flight data recorder (FDR) implementation files.
|
|
|
|
set(XRAY_FDR_SOURCES
|
|
|
|
xray_buffer_queue.cc)
|
2016-07-21 15:39:55 +08:00
|
|
|
|
|
|
|
set(x86_64_SOURCES
|
2016-11-16 09:01:13 +08:00
|
|
|
xray_x86_64.cc
|
|
|
|
xray_trampoline_x86_64.S
|
|
|
|
${XRAY_SOURCES})
|
2016-07-21 15:39:55 +08:00
|
|
|
|
2016-09-20 22:35:57 +08:00
|
|
|
set(arm_SOURCES
|
2016-11-16 09:01:13 +08:00
|
|
|
xray_arm.cc
|
|
|
|
xray_trampoline_arm.S
|
|
|
|
${XRAY_SOURCES})
|
2016-09-20 22:35:57 +08:00
|
|
|
|
2017-01-03 12:04:00 +08:00
|
|
|
set(armhf_SOURCES ${arm_SOURCES})
|
2016-09-20 22:35:57 +08:00
|
|
|
|
2016-11-21 11:20:43 +08:00
|
|
|
set(aarch64_SOURCES
|
2017-01-03 12:04:00 +08:00
|
|
|
xray_AArch64.cc
|
|
|
|
xray_trampoline_AArch64.S
|
|
|
|
${XRAY_SOURCES})
|
2016-11-21 11:20:43 +08:00
|
|
|
|
2016-07-21 15:39:55 +08:00
|
|
|
include_directories(..)
|
|
|
|
include_directories(../../include)
|
|
|
|
|
|
|
|
set(XRAY_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
|
|
|
set(XRAY_COMMON_DEFINITIONS XRAY_HAS_EXCEPTIONS=1)
|
2016-11-16 09:01:13 +08:00
|
|
|
append_list_if(
|
|
|
|
COMPILER_RT_HAS_XRAY_COMPILER_FLAG XRAY_SUPPORTED=1 XRAY_COMMON_DEFINITIONS)
|
2016-07-21 15:39:55 +08:00
|
|
|
|
|
|
|
add_compiler_rt_object_libraries(RTXray
|
2016-12-06 14:24:08 +08:00
|
|
|
ARCHS ${XRAY_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${XRAY_SOURCES} CFLAGS ${XRAY_CFLAGS}
|
|
|
|
DEFS ${XRAY_COMMON_DEFINITIONS})
|
|
|
|
|
2017-01-03 12:04:00 +08:00
|
|
|
add_compiler_rt_object_libraries(RTXrayFDR
|
|
|
|
ARCHS ${XRAY_SUPPORTED_ARCH}
|
|
|
|
SOURCES ${XRAY_FDR_SOURCES} CFLAGS ${XRAY_CFLAGS}
|
|
|
|
DEFS ${XRAY_COMMON_DEFINITIONS})
|
|
|
|
|
2016-08-27 04:52:22 +08:00
|
|
|
add_compiler_rt_component(xray)
|
2017-01-03 12:04:00 +08:00
|
|
|
add_compiler_rt_component(xray-fdr)
|
2016-08-27 04:52:22 +08:00
|
|
|
|
2016-07-21 15:39:55 +08:00
|
|
|
set(XRAY_COMMON_RUNTIME_OBJECT_LIBS
|
2016-11-16 09:01:13 +08:00
|
|
|
RTSanitizerCommon
|
2017-01-12 09:37:35 +08:00
|
|
|
RTSanitizerCommonLibc)
|
2016-07-21 15:39:55 +08:00
|
|
|
|
2016-12-06 14:24:08 +08:00
|
|
|
foreach(arch ${XRAY_SUPPORTED_ARCH})
|
|
|
|
if(CAN_TARGET_${arch})
|
|
|
|
add_compiler_rt_runtime(clang_rt.xray
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
|
|
|
SOURCES ${${arch}_SOURCES}
|
|
|
|
CFLAGS ${XRAY_CFLAGS}
|
|
|
|
DEFS ${XRAY_COMMON_DEFINITIONS}
|
|
|
|
OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS}
|
|
|
|
PARENT_TARGET xray)
|
2017-01-03 12:04:00 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.xray-fdr
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
|
|
|
SOURCES ${XRAY_FDR_SOURCES}
|
|
|
|
CFLAGS ${XRAY_CFLAGS}
|
|
|
|
DEFS ${XRAY_COMMON_DEFINITIONS}
|
|
|
|
OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS}
|
|
|
|
PARENT_TARGET xray-fdr)
|
2016-12-06 14:24:08 +08:00
|
|
|
endif()
|
2016-07-21 15:39:55 +08:00
|
|
|
endforeach()
|
2016-12-06 14:24:08 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|